Trait blstrs::PrimeFieldRepr [−][src]
This trait represents a wrapper around a biginteger which can encode any element of a particular
prime field. It is a smart wrapper around a sequence of u64
limbs, least-significant digit
first.
Required methods
pub fn sub_noborrow(&mut self, other: &Self)
[src]
Subtract another represetation from this one.
pub fn add_nocarry(&mut self, other: &Self)
[src]
Add another representation to this one.
pub fn num_bits(&self) -> u32
[src]
Compute the number of bits needed to encode this number. Always a multiple of 64.
pub fn is_zero(&self) -> bool
[src]
Returns true iff this number is zero.
pub fn is_odd(&self) -> bool
[src]
Returns true iff this number is odd.
pub fn is_even(&self) -> bool
[src]
Returns true iff this number is even.
pub fn div2(&mut self)
[src]
Performs a rightwise bitshift of this number, effectively dividing it by 2.
pub fn shr(&mut self, amt: u32)
[src]
Performs a rightwise bitshift of this number by some amount.
pub fn mul2(&mut self)
[src]
Performs a leftwise bitshift of this number, effectively multiplying it by 2. Overflow is ignored.
pub fn shl(&mut self, amt: u32)
[src]
Performs a leftwise bitshift of this number by some amount.
Provided methods
pub fn write_be<W>(&self, writer: W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Writes this PrimeFieldRepr
as a big endian integer.
pub fn read_be<R>(&mut self, reader: R) -> Result<(), Error> where
R: Read,
[src]
R: Read,
Reads a big endian integer into this representation.
pub fn write_le<W>(&self, writer: W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
Writes this PrimeFieldRepr
as a little endian integer.
pub fn read_le<R>(&mut self, reader: R) -> Result<(), Error> where
R: Read,
[src]
R: Read,
Reads a little endian integer into this representation.