mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Add FieldElement::is_zero()
This commit is contained in:
parent
d0bc40783b
commit
cb4ff3097c
1 changed files with 9 additions and 0 deletions
|
|
@ -521,6 +521,15 @@ impl FieldElement {
|
|||
(bytes[0] & 1) as i32
|
||||
}
|
||||
|
||||
/// Determine if this `FieldElement` is zero.
|
||||
///
|
||||
/// # Return
|
||||
///
|
||||
/// If zero, return `1u8`. Otherwise, return `0u8`.
|
||||
pub fn is_zero(&self) -> u8 {
|
||||
return 1u8 & (!self.is_nonzero());
|
||||
}
|
||||
|
||||
/// Determine if this `FieldElement` is non-zero.
|
||||
///
|
||||
/// # Return
|
||||
|
|
|
|||
Loading…
Reference in a new issue