mirror of https://github.com/zcash/halo2.git
Add `Assigned::is_zero_vartime` method
This commit is contained in:
parent
9d0e0b7be9
commit
927463f76a
|
@ -152,6 +152,18 @@ impl<F: Field> Assigned<F> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true iff this element is zero.
|
||||||
|
pub fn is_zero_vartime(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Self::Zero => true,
|
||||||
|
Self::Trivial(x) => x.is_zero_vartime(),
|
||||||
|
// Assigned maps x/0 -> 0.
|
||||||
|
Self::Rational(numerator, denominator) => {
|
||||||
|
numerator.is_zero_vartime() || denominator.is_zero_vartime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Inverts this assigned value (taking the inverse of zero to be zero).
|
/// Inverts this assigned value (taking the inverse of zero to be zero).
|
||||||
pub fn invert(&self) -> Self {
|
pub fn invert(&self) -> Self {
|
||||||
match self {
|
match self {
|
||||||
|
|
Loading…
Reference in New Issue