mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-30 20:11:23 +00:00
ff: PrimeField::{is_even, is_odd}
This commit is contained in:
@@ -1029,6 +1029,11 @@ fn prime_field_impl(
|
||||
r.0
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn is_odd(&self) -> bool {
|
||||
self.into_repr().is_odd()
|
||||
}
|
||||
|
||||
fn char() -> #repr {
|
||||
MODULUS
|
||||
}
|
||||
|
@@ -309,6 +309,15 @@ pub trait PrimeField: Field + From<u64> {
|
||||
/// the number is an element of the field.
|
||||
fn into_repr(&self) -> Self::Repr;
|
||||
|
||||
/// Returns true iff this element is odd.
|
||||
fn is_odd(&self) -> bool;
|
||||
|
||||
/// Returns true iff this element is even.
|
||||
#[inline(always)]
|
||||
fn is_even(&self) -> bool {
|
||||
!self.is_odd()
|
||||
}
|
||||
|
||||
/// Returns the field characteristic; the modulus.
|
||||
fn char() -> Self::Repr;
|
||||
|
||||
|
Reference in New Issue
Block a user