Struct num_modular::udouble
source · pub struct udouble {
pub hi: umax,
pub lo: umax,
}
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§
source§impl udouble
impl udouble
pub const MAX: Self = _
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>
Trait Implementations§
source§impl AddAssign<u128> for udouble
impl AddAssign<u128> for udouble
source§fn add_assign(&mut self, rhs: umax)
fn add_assign(&mut self, rhs: umax)
Performs the
+=
operation. Read moresource§impl AddAssign<udouble> for udouble
impl AddAssign<udouble> for udouble
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl BitAndAssign<udouble> for udouble
impl BitAndAssign<udouble> for udouble
source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&=
operation. Read moresource§impl BitOrAssign<udouble> for udouble
impl BitOrAssign<udouble> for udouble
source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|=
operation. Read moresource§impl BitXorAssign<udouble> for udouble
impl BitXorAssign<udouble> for udouble
source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^=
operation. Read moresource§impl Ord for udouble
impl Ord for udouble
source§impl PartialEq<udouble> for udouble
impl PartialEq<udouble> for udouble
source§impl PartialOrd<udouble> for udouble
impl PartialOrd<udouble> for udouble
1.0.0 · source§fn 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 moresource§impl ShlAssign<u16> for udouble
impl ShlAssign<u16> for udouble
source§fn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
Performs the
<<=
operation. Read moresource§impl ShlAssign<u32> for udouble
impl ShlAssign<u32> for udouble
source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
Performs the
<<=
operation. Read moresource§impl ShlAssign<u8> for udouble
impl ShlAssign<u8> for udouble
source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
Performs the
<<=
operation. Read moresource§impl ShrAssign<u16> for udouble
impl ShrAssign<u16> for udouble
source§fn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
Performs the
>>=
operation. Read moresource§impl ShrAssign<u32> for udouble
impl ShrAssign<u32> for udouble
source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Performs the
>>=
operation. Read moresource§impl ShrAssign<u8> for udouble
impl ShrAssign<u8> for udouble
source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
Performs the
>>=
operation. Read moresource§impl SubAssign<u128> for udouble
impl SubAssign<u128> for udouble
source§fn sub_assign(&mut self, rhs: umax)
fn sub_assign(&mut self, rhs: umax)
Performs the
-=
operation. Read moresource§impl SubAssign<udouble> for udouble
impl SubAssign<udouble> for udouble
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl 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§
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