#[repr(C)]pub struct U256(pub [u128; 2]);
Expand description
256-bit, stack allocated biginteger for use in prime field arithmetic.
Tuple Fields§
§0: [u128; 2]
Implementations§
Source§impl U256
impl U256
Sourcepub fn from_slice(s: &[u8]) -> Result<U256, Error>
pub fn from_slice(s: &[u8]) -> Result<U256, Error>
Initialize U256 from slice of bytes (big endian)
pub fn to_big_endian(&self, s: &mut [u8]) -> Result<(), Error>
pub fn zero() -> U256
pub fn one() -> U256
pub fn is_zero(&self) -> bool
pub fn set_bit(&mut self, n: usize, to: bool) -> bool
pub fn get_bit(&self, n: usize) -> Option<bool>
Sourcepub fn mul(&mut self, other: &U256, modulo: &U256, inv: u128)
pub fn mul(&mut self, other: &U256, modulo: &U256, inv: u128)
Multiply self
by other
(mod modulo
) via the Montgomery
multiplication method.
pub fn is_even(&self) -> bool
Sourcepub fn bits(&self) -> BitIterator<'_> ⓘ
pub fn bits(&self) -> BitIterator<'_> ⓘ
Return an Iterator<Item=bool> over all bits from MSB to LSB.
Trait Implementations§
Source§impl Ord for U256
impl Ord for U256
Source§impl PartialOrd for U256
impl PartialOrd for U256
impl Copy for U256
impl Eq for U256
impl StructuralPartialEq for U256
Auto Trait Implementations§
impl Freeze for U256
impl RefUnwindSafe for U256
impl Send for U256
impl Sync for U256
impl Unpin for U256
impl UnwindSafe for U256
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more