Struct num_modular::udouble
source · [−]Expand description
A double width integer type based on the largest built-in integer type umax (currently u128), and to support double-width operations on it is the only goal for this type.
Although it can be regarded as u256, it’s not as feature-rich as in other crates since it’s only designed to support this crate and few other crates (will be noted in comments).
Fields
hi: umax
Most significant part
lo: umax
Least significant part
Implementations
sourceimpl udouble
impl udouble
pub const fn widening_add(lhs: umax, rhs: umax) -> Self
sourcepub const fn widening_mul(lhs: umax, rhs: umax) -> Self
pub const fn widening_mul(lhs: umax, rhs: umax) -> Self
Calculate multiplication of two umax integers with result represented in double width integer
sourcepub const fn widening_square(x: umax) -> Self
pub const fn widening_square(x: umax) -> Self
Optimized squaring function for umax integers
pub const fn overflowing_add(&self, rhs: Self) -> (Self, bool)
sourcepub const fn overflowing_mul1(&self, rhs: umax) -> (Self, bool)
pub const fn overflowing_mul1(&self, rhs: umax) -> (Self, bool)
Multiplication of double width and single width
sourcepub fn checked_mul1(&self, rhs: umax) -> Option<Self>
pub fn checked_mul1(&self, rhs: umax) -> Option<Self>
Multiplication of double width and single width
pub fn checked_shl(self, rhs: u32) -> Option<Self>
pub fn checked_shr(self, rhs: u32) -> Option<Self>
sourceimpl udouble
impl udouble
pub const fn leading_zeros(self) -> u32
Trait Implementations
sourceimpl AddAssign<u128> for udouble
impl AddAssign<u128> for udouble
sourcefn add_assign(&mut self, rhs: umax)
fn add_assign(&mut self, rhs: umax)
Performs the +=
operation. Read more
sourceimpl AddAssign<udouble> for udouble
impl AddAssign<udouble> for udouble
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl BitAndAssign<udouble> for udouble
impl BitAndAssign<udouble> for udouble
sourcefn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the &=
operation. Read more
sourceimpl BitOrAssign<udouble> for udouble
impl BitOrAssign<udouble> for udouble
sourcefn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the |=
operation. Read more
sourceimpl BitXorAssign<udouble> for udouble
impl BitXorAssign<udouble> for udouble
sourcefn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the ^=
operation. Read more
sourceimpl Ord for udouble
impl Ord for udouble
sourceimpl PartialOrd<udouble> for udouble
impl PartialOrd<udouble> for udouble
sourcefn partial_cmp(&self, other: &udouble) -> Option<Ordering>
fn partial_cmp(&self, other: &udouble) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl ShlAssign<u16> for udouble
impl ShlAssign<u16> for udouble
sourcefn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
Performs the <<=
operation. Read more
sourceimpl ShlAssign<u32> for udouble
impl ShlAssign<u32> for udouble
sourcefn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
Performs the <<=
operation. Read more
sourceimpl ShlAssign<u8> for udouble
impl ShlAssign<u8> for udouble
sourcefn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
Performs the <<=
operation. Read more
sourceimpl ShrAssign<u16> for udouble
impl ShrAssign<u16> for udouble
sourcefn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
Performs the >>=
operation. Read more
sourceimpl ShrAssign<u32> for udouble
impl ShrAssign<u32> for udouble
sourcefn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Performs the >>=
operation. Read more
sourceimpl ShrAssign<u8> for udouble
impl ShrAssign<u8> for udouble
sourcefn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
Performs the >>=
operation. Read more
sourceimpl SubAssign<u128> for udouble
impl SubAssign<u128> for udouble
sourcefn sub_assign(&mut self, rhs: umax)
fn sub_assign(&mut self, rhs: umax)
Performs the -=
operation. Read more
sourceimpl SubAssign<udouble> for udouble
impl SubAssign<udouble> for udouble
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -=
operation. Read more
impl Copy for udouble
impl Eq for udouble
impl StructuralEq for udouble
impl StructuralPartialEq for udouble
Auto Trait Implementations
impl RefUnwindSafe for udouble
impl Send for udouble
impl Sync for udouble
impl Unpin for udouble
impl UnwindSafe for udouble
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more