Expand description
A fixed-size big integer implementation, unsigned only.
FixedUInt<T, N, P> is N limbs of a primitive T (u8/u16/u32/u64)
with a compile-time Personality (Nct or Ct) that selects between
value-dependent and constant-time impl bodies at every operator.
Basic usage:
use fixed_bigint::FixedUInt;
let a : FixedUInt<u8,2> = 200u8.into();
assert_eq!( a + a , 400u16.into() );
assert_eq!( a * &100u8.into(), 20000u16.into() )With the num-traits feature (default), FixedUInt also implements
num_integer::Integer and the num_traits::PrimInt bundle:
use fixed_bigint::FixedUInt;
use num_integer::Integer;
let a : FixedUInt<u8,2> = 400u16.into();
assert_eq!( a.is_multiple_of( &(8u8.into()) ) , true );
assert_eq!( a.gcd( &(300u16.into() )) , 100u8.into() );
assert_eq!( a.lcm( &(440u16.into() )) , 4400u16.into() );Re-exports§
pub use crate::fixeduint::FixedUInt;pub use crate::fixeduint::NonZeroFixedUInt;
Modules§
- fixeduint
- Fixed-size big integer implementation
Traits§
- Machine
Word - Represents a CPU native word, from 8-bit to 64-bit, with corresponding double-word to hold multiplication/division products.