macro_rules! impl_mont_field_element { ( $curve:tt, $fe:tt, $bytes:ty, $uint:ty, $modulus:expr, $arr:ty, $from_mont:ident, $to_mont:ident, $add:ident, $sub:ident, $mul:ident, $neg:ident, $square:ident ) => { ... }; }
Expand description
Implements a field element type whose internal representation is in
Montgomery form, providing a combination of trait impls and inherent impls
which are const fn
where possible.
Accepts a set of const fn
arithmetic operation functions as arguments.
§Inherent impls
const ZERO: Self
const ONE: Self
(multiplicative identity)pub fn from_bytes
pub fn from_slice
pub fn from_uint
fn from_uint_unchecked
pub fn to_bytes
pub fn to_canonical
pub fn is_odd
pub fn is_zero
pub fn double
NOTE: field implementations must provide their own inherent impls of the following methods in order for the code generated by this macro to compile:
pub fn invert
pub fn sqrt
§Trait impls
AsRef<$arr>
ConditionallySelectable
ConstantTimeEq
ConstantTimeGreater
ConstantTimeLess
Default
DefaultIsZeroes
Eq
Field
PartialEq
§Ops
Add
AddAssign
Sub
SubAssign
Mul
MulAssign
Neg