pub struct U512 { /* private fields */ }Expand description
The 512-bit unsigned integer type.
The high and low words depend on the target endianness.
Conversion to and from big endian should be done via
to_le_bytes and to_be_bytes.
Our formatting specifications are limited: we ignore a
lot of settings, and only respect alternate among the
formatter flags. So, we implement all the main formatters
(Binary, etc.), but ignore all flags like width.
Note that this type is NOT safe to use in FFIs, since the
underlying storage may use 128-bit integers in the future
which are not FFI-safe. If you would like to use this type
within a FFI, use to_le_bytes and to_be_bytes.
Implementations§
Source§impl U512
impl U512
Sourcepub const MIN: Self
pub const MIN: Self
The smallest value that can be represented by this integer type.
See u128::MIN.
Sourcepub const MAX: Self
pub const MAX: Self
The largest value that can be represented by this integer type (2256 - 1).
See u128::MAX.
Sourcepub const IS_SIGNED: bool = false
pub const IS_SIGNED: bool = false
If the integer is signed, that is, can contain negative numbers.
Sourcepub const fn min_value() -> Self
👎Deprecated
pub const fn min_value() -> Self
New code should prefer to use u128::MIN instead.
Returns the smallest value that can be represented by this integer type.
See u128::min_value.
Sourcepub const fn max_value() -> Self
👎Deprecated
pub const fn max_value() -> Self
New code should prefer to use u128::MAX instead.
Returns the largest value that can be represented by this integer type.
See u128::max_value.
Sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
See u128::count_ones.
Sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
See u128::count_zeros.
Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of
self.
Depending on what you’re doing with the value, you might also be
interested in the ilog2 function which returns a consistent
number, even if the type widens.
§Examples
let n = i256::MAX >> 2i32;
assert_eq!(n.leading_zeros(), 3);
let min = i256::MIN;
assert_eq!(min.leading_zeros(), 0);
let zero = i256::from_u8(0);
assert_eq!(zero.leading_zeros(), 256);
let max = i256::MAX;
assert_eq!(max.leading_zeros(), 1);See u128::leading_zeros.
Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation of
self.
See u128::trailing_zeros.
Sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of
self.
See u128::leading_ones.
Sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation of
self.
See u128::trailing_ones.
Sourcepub const fn bitand_const(self, rhs: Self) -> Self
pub const fn bitand_const(self, rhs: Self) -> Self
Const implementation of BitAnd.
Sourcepub const fn bitor_const(self, rhs: Self) -> Self
pub const fn bitor_const(self, rhs: Self) -> Self
Const implementation of BitOr.
Sourcepub const fn bitxor_const(self, rhs: Self) -> Self
pub const fn bitxor_const(self, rhs: Self) -> Self
Const implementation of BitXor.
Sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n,
wrapping the truncated bits to the end of the resulting integer.
Please note this isn’t the same operation as the << shifting operator!
See u128::rotate_left.
Sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n,
wrapping the truncated bits to the beginning of the resulting
integer.
Please note this isn’t the same operation as the >> shifting operator!
See u128::rotate_right.
Sourcepub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
Panic-free bitwise shift-left; yields self << mask(rhs),
where mask removes any high-order bits of rhs that
would cause the shift to exceed the bitwidth of the type.
Note that this is not the same as a rotate-left; the
RHS of a wrapping shift-left is restricted to the range
of the type, rather than the bits shifted out of the LHS
being returned to the other end. The primitive integer
types all implement a rotate_left function,
which may be what you want instead.
See u128::wrapping_shl.
Sourcepub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
Panic-free bitwise shift-right; yields self >> mask(rhs),
where mask removes any high-order bits of rhs that
would cause the shift to exceed the bitwidth of the type.
Note that this is not the same as a rotate-right; the
RHS of a wrapping shift-right is restricted to the range
of the type, rather than the bits shifted out of the LHS
being returned to the other end. The primitive integer
types all implement a rotate_right function,
which may be what you want instead.
See u128::wrapping_shr.
Sourcepub const fn swap_bytes(&self) -> Self
pub const fn swap_bytes(&self) -> Self
Reverses the byte order of the integer.
§Assembly
This optimizes very nicely, with efficient bswap or rol
implementations for each.
See i128::swap_bytes.
Sourcepub const fn reverse_bits(&self) -> Self
pub const fn reverse_bits(&self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
See i128::reverse_bits.
Sourcepub const fn from_be(x: Self) -> Self
pub const fn from_be(x: Self) -> Self
Converts an integer from big endian to the target’s endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
See i128::from_be.
Sourcepub const fn from_le(x: Self) -> Self
pub const fn from_le(x: Self) -> Self
Converts an integer from little endian to the target’s endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
See i128::from_le.
Sourcepub const fn to_be(self) -> Self
pub const fn to_be(self) -> Self
Converts self to big endian from the target’s endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
See i128::to_be.
Sourcepub const fn to_le(self) -> Self
pub const fn to_le(self) -> Self
Converts self to little endian from the target’s endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
See i128::to_le.
Sourcepub const fn to_be_bytes(self) -> [u8; 64]
pub const fn to_be_bytes(self) -> [u8; 64]
Returns the memory representation of this integer as a byte array in big-endian (network) byte order.
See i128::to_be_bytes.
Sourcepub const fn to_le_bytes(self) -> [u8; 64]
pub const fn to_le_bytes(self) -> [u8; 64]
Returns the memory representation of this integer as a byte array in little-endian byte order.
See i128::to_le_bytes.
Sourcepub const fn to_ne_bytes(self) -> [u8; 64]
pub const fn to_ne_bytes(self) -> [u8; 64]
Returns the memory representation of this integer as a byte array in native byte order.
As the target platform’s native endianness is used, portable code
should use to_be_bytes or to_le_bytes, as appropriate,
instead.
See i128::to_ne_bytes.
Sourcepub const fn from_be_bytes(bytes: [u8; 64]) -> Self
pub const fn from_be_bytes(bytes: [u8; 64]) -> Self
Creates a native endian integer value from its representation as a byte array in big endian.
See i128::from_be_bytes.
Sourcepub const fn from_le_bytes(bytes: [u8; 64]) -> Self
pub const fn from_le_bytes(bytes: [u8; 64]) -> Self
Creates a native endian integer value from its representation as a byte array in little endian.
See i128::from_le_bytes.
Sourcepub const fn from_ne_bytes(bytes: [u8; 64]) -> Self
pub const fn from_ne_bytes(bytes: [u8; 64]) -> Self
Creates a native endian integer value from its memory representation as a byte array in native endianness.
As the target platform’s native endianness is used, portable code
likely wants to use from_be_bytes or from_le_bytes, as
appropriate instead.
See i128::from_ne_bytes.
Sourcepub const fn to_be_limbs(self) -> [ULimb; 16]
pub const fn to_be_limbs(self) -> [ULimb; 16]
Returns the memory representation of this as a series of limbs in big-endian (network) byte order.
The value of each limb stays the same, however, the order that each is stored within the buffer is in big-endian order.
Sourcepub const fn to_le_limbs(self) -> [ULimb; 16]
pub const fn to_le_limbs(self) -> [ULimb; 16]
Returns the memory representation of this as a series of limbs in little-endian byte order.
The value of each limb stays the same, however, the order that each is stored within the buffer is in little-endian order.
Sourcepub const fn to_ne_limbs(self) -> [ULimb; 16]
pub const fn to_ne_limbs(self) -> [ULimb; 16]
Returns the memory representation of this as a series of limbs.
As the target platform’s native endianness is used, portable code
should use to_be_limbs or to_le_limbs, as appropriate,
instead.
Sourcepub const fn from_be_limbs(limbs: [ULimb; 16]) -> Self
pub const fn from_be_limbs(limbs: [ULimb; 16]) -> Self
Creates a native endian integer value from its representation as limbs in big endian.
The value of each limb stays the same, however, the order that each is stored within the buffer as if it was from big-endian order.
Sourcepub const fn from_le_limbs(limbs: [ULimb; 16]) -> Self
pub const fn from_le_limbs(limbs: [ULimb; 16]) -> Self
Creates a native endian integer value from its representation as limbs in little endian.
The value of each limb stays the same, however, the order that each is stored within the buffer as if it was from little-endian order.
Sourcepub const fn from_ne_limbs(limbs: [ULimb; 16]) -> Self
pub const fn from_ne_limbs(limbs: [ULimb; 16]) -> Self
Creates a native endian integer value from its memory representation as limbs in native endianness.
As the target platform’s native endianness is used, portable code
likely wants to use from_be_limbs or from_le_limbs, as
appropriate instead.
Sourcepub const fn to_be_wide(self) -> [UWide; 8]
pub const fn to_be_wide(self) -> [UWide; 8]
Returns the memory representation of this as a series of wide in big-endian (network) byte order.
Sourcepub const fn to_le_wide(self) -> [UWide; 8]
pub const fn to_le_wide(self) -> [UWide; 8]
Returns the memory representation of this as a series of wide in little-endian byte order.
Sourcepub const fn to_ne_wide(self) -> [UWide; 8]
pub const fn to_ne_wide(self) -> [UWide; 8]
Returns the memory representation of this as a series of wide types.
As the target platform’s native endianness is used, portable code
should use to_be_wide or to_le_wide, as appropriate,
instead.
Sourcepub const fn from_be_wide(wide: [UWide; 8]) -> Self
pub const fn from_be_wide(wide: [UWide; 8]) -> Self
Creates a native endian integer value from its representation as a wide type in big endian.
Sourcepub const fn from_le_wide(wide: [UWide; 8]) -> Self
pub const fn from_le_wide(wide: [UWide; 8]) -> Self
Creates a native endian integer value from its representation as a wide type in little endian.
Sourcepub const fn from_ne_wide(wide: [UWide; 8]) -> Self
pub const fn from_ne_wide(wide: [UWide; 8]) -> Self
Creates a native endian integer value from its memory representation as a wide type in native endianness.
As the target platform’s native endianness is used, portable code
likely wants to use from_be_wide or from_le_wide, as
appropriate instead.
Sourcepub const fn to_be_u32(self) -> [u32; 16]
pub const fn to_be_u32(self) -> [u32; 16]
Returns the memory representation of this as a series of u32 digits
in big-endian order.
Sourcepub const fn to_le_u32(self) -> [u32; 16]
pub const fn to_le_u32(self) -> [u32; 16]
Returns the memory representation of this as a series of u32 digits
in litte-endian order.
Sourcepub const fn from_be_u32(value: [u32; 16]) -> Self
pub const fn from_be_u32(value: [u32; 16]) -> Self
Creates a native endian integer value from its representation
as u32 elements in big-endian.
Sourcepub const fn from_le_u32(value: [u32; 16]) -> Self
pub const fn from_le_u32(value: [u32; 16]) -> Self
Creates a native endian integer value from its representation
as u32 elements in little-endian.
Sourcepub const fn from_ne_u32(value: [u32; 16]) -> Self
pub const fn from_ne_u32(value: [u32; 16]) -> Self
Creates a native endian integer value from its memory representation
as u32 in native endianness.
As the target platform’s native endianness is used, portable code
likely wants to use from_be_u32 or from_le_u32, as
appropriate instead.
Sourcepub const fn to_be_u64(self) -> [u64; 8]
pub const fn to_be_u64(self) -> [u64; 8]
Returns the memory representation of this as a series of u64 digits
in big-endian order.
Sourcepub const fn to_le_u64(self) -> [u64; 8]
pub const fn to_le_u64(self) -> [u64; 8]
Returns the memory representation of this as a series of u64 digits
in litte-endian order.
Sourcepub const fn from_be_u64(value: [u64; 8]) -> Self
pub const fn from_be_u64(value: [u64; 8]) -> Self
Creates a native endian integer value from its representation
as u64 elements in big-endian.
Sourcepub const fn from_le_u64(value: [u64; 8]) -> Self
pub const fn from_le_u64(value: [u64; 8]) -> Self
Creates a native endian integer value from its representation
as u64 elements in little-endian.
Sourcepub const fn from_ne_u64(value: [u64; 8]) -> Self
pub const fn from_ne_u64(value: [u64; 8]) -> Self
Creates a native endian integer value from its memory representation
as u64 in native endianness.
As the target platform’s native endianness is used, portable code
likely wants to use from_be_u64 or from_le_u64, as
appropriate instead.
Sourcepub const fn eq_branched(self, rhs: Self) -> bool
pub const fn eq_branched(self, rhs: Self) -> bool
Short-circuiting const implementation of Eq.
Sourcepub const fn eq_const(self, rhs: Self) -> bool
pub const fn eq_const(self, rhs: Self) -> bool
Non-short circuiting const implementation of Eq.
Sourcepub const fn lt_const(self, rhs: Self) -> bool
pub const fn lt_const(self, rhs: Self) -> bool
Non-short circuiting const implementation of PartialOrd::lt.
Sourcepub const fn le_const(self, rhs: Self) -> bool
pub const fn le_const(self, rhs: Self) -> bool
Non-short circuiting const implementation of PartialOrd::le.
Sourcepub const fn gt_const(self, rhs: Self) -> bool
pub const fn gt_const(self, rhs: Self) -> bool
Non-short circuiting const implementation of PartialOrd::gt.
Sourcepub const fn ge_const(self, rhs: Self) -> bool
pub const fn ge_const(self, rhs: Self) -> bool
Non-short circuiting const implementation of PartialOrd::ge.
Sourcepub const fn cmp_const(self, rhs: Self) -> Ordering
pub const fn cmp_const(self, rhs: Self) -> Ordering
Non-short circuiting const implementation of PartialOrd::cmp.
Sourcepub const fn from_u8(value: u8) -> Self
pub const fn from_u8(value: u8) -> Self
Create the 512-bit unsigned integer from a u8, as if by an as cast.
Sourcepub const fn from_u16(value: u16) -> Self
pub const fn from_u16(value: u16) -> Self
Create the 512-bit unsigned integer from a u16, as if by an as cast.
Sourcepub const fn from_u32(value: u32) -> Self
pub const fn from_u32(value: u32) -> Self
Create the 512-bit unsigned integer from a u32, as if by an as cast.
Sourcepub const fn from_u64(value: u64) -> Self
pub const fn from_u64(value: u64) -> Self
Create the 512-bit unsigned integer from a u64, as if by an as cast.
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Create the 512-bit unsigned integer from a u128, as if by an as cast.
Sourcepub const fn from_ulimb(value: ULimb) -> Self
pub const fn from_ulimb(value: ULimb) -> Self
Create the 512-bit unsigned integer from an unsigned limb, as if by an as cast.
Sourcepub const fn from_uwide(value: UWide) -> Self
pub const fn from_uwide(value: UWide) -> Self
Create the 512-bit unsigned integer from an unsigned wide type, as if by an as cast.
Sourcepub const fn from_unsigned(value: Self) -> Self
pub const fn from_unsigned(value: Self) -> Self
Create the 512-bit unsigned integer from an unsigned integer, as if by an as cast.
Sourcepub const fn from_signed(value: I512) -> Self
pub const fn from_signed(value: I512) -> Self
Create the 512-bit unsigned integer from a signed integer, as if by an as cast.
Sourcepub const fn from_i8(value: i8) -> Self
pub const fn from_i8(value: i8) -> Self
Create the 512-bit unsigned integer from an i8, as if by an as cast.
Sourcepub const fn from_i16(value: i16) -> Self
pub const fn from_i16(value: i16) -> Self
Create the 512-bit unsigned integer from an i16, as if by an as cast.
Sourcepub const fn from_i32(value: i32) -> Self
pub const fn from_i32(value: i32) -> Self
Create the 512-bit unsigned integer from an i32, as if by an as cast.
Sourcepub const fn from_i64(value: i64) -> Self
pub const fn from_i64(value: i64) -> Self
Create the 512-bit unsigned integer from an i64, as if by an as cast.
Sourcepub const fn from_i128(value: i128) -> Self
pub const fn from_i128(value: i128) -> Self
Create the 256-bit unsigned integer from an i128, as if by an as
cast.
Sourcepub const fn from_ilimb(value: ILimb) -> Self
pub const fn from_ilimb(value: ILimb) -> Self
Create the 512-bit unsigned integer from a signed limb, as if by an as cast.
Sourcepub const fn from_iwide(value: IWide) -> Self
pub const fn from_iwide(value: IWide) -> Self
Create the 512-bit unsigned integer from a wide type, as if by an as cast.
Sourcepub const fn as_ulimb(&self) -> ULimb
pub const fn as_ulimb(&self) -> ULimb
Convert the 512-bit unsigned an unsigned limb, as if by an as cast.
Sourcepub const fn as_u128(&self) -> u128
pub const fn as_u128(&self) -> u128
Convert the 512-bit unsigned to a u128, as if by an as cast.
Sourcepub const fn as_uwide(&self) -> UWide
pub const fn as_uwide(&self) -> UWide
Convert the 512-bit unsigned an unsigned wide type, as if by an as cast.
Sourcepub const fn as_i128(&self) -> i128
pub const fn as_i128(&self) -> i128
Convert the 512-bit unsigned to a i128, as if by an as cast.
Sourcepub const fn as_ilimb(&self) -> ILimb
pub const fn as_ilimb(&self) -> ILimb
Convert the 512-bit unsigned a signed limb, as if by an as cast.
Sourcepub const fn as_iwide(&self) -> IWide
pub const fn as_iwide(&self) -> IWide
Convert the 512-bit unsigned a signed wide type, as if by an as cast.
Sourcepub const fn as_unsigned(&self) -> Self
pub const fn as_unsigned(&self) -> Self
Convert the 512-bit unsigned unsigned integer to the unsigned type, as if by an as cast.
Sourcepub const fn as_signed(&self) -> I512
pub const fn as_signed(&self) -> I512
Convert the 512-bit unsigned unsigned integer to the signed type, as if by an as cast.
Sourcepub const fn cast_signed(self) -> I512
pub const fn cast_signed(self) -> I512
Returns the bit pattern of self reinterpreted as a signed integer of
the same size.
This produces the same result as an as cast, but ensures that the
bit-width remains the same.
See u128::cast_signed.
Sourcepub const fn get_limb(&self, index: usize) -> ULimb
pub const fn get_limb(&self, index: usize) -> ULimb
Get the limb indexing from the least-significant order.
Sourcepub const fn get_wide(&self, index: usize) -> UWide
pub const fn get_wide(&self, index: usize) -> UWide
Get the wide value indexing from the least-significant order.
This optimizes extremely well, if the index is known ahead of time
into 2 mov instructions, that is, as efficient as can be.
Sourcepub const fn least_significant_limb(&self) -> ULimb
pub const fn least_significant_limb(&self) -> ULimb
Get the least significant limb in the buiffer.
Sourcepub const fn most_significant_limb(&self) -> ULimb
pub const fn most_significant_limb(&self) -> ULimb
Get the most significant limb in the buiffer.
Sourcepub const fn low(self) -> Self
pub const fn low(self) -> Self
Get the lower half of the integer, that is, the bits in [0, BITS/2).
Sourcepub const fn high(self) -> Self
pub const fn high(self) -> Self
Get the upper half of the integer, that is, the bits in [BITS/2, BITS),
shifted into place to the lower half.
Sourcepub const fn high_mul(self, rhs: Self) -> Self
pub const fn high_mul(self, rhs: Self) -> Self
Multiply two values, grabbing the high half of the product.
Naively, this is Self::widening_mul and then taking the
high half, however, this can use custom optimizations.
Sourcepub const fn pow(self, exp: u32) -> Self
pub const fn pow(self, exp: u32) -> Self
Raises self to the power of exp, using exponentiation by squaring.
See u128::pow.
Sourcepub fn div_rem(self, n: Self) -> (Self, Self)
pub fn div_rem(self, n: Self) -> (Self, Self)
Get the quotient and remainder of our big integer division.
This allows storing of both the quotient and remainder without making repeated calls.
§Panics
This panics if the divisor is 0.
Sourcepub fn div_euclid(self, rhs: Self) -> Self
pub fn div_euclid(self, rhs: Self) -> Self
Performs Euclidean division.
Since, for the positive integers, all common
definitions of division are equal, this
is exactly equal to self / rhs.
§Panics
This function will panic if rhs is zero.
See u128::div_euclid.
Sourcepub fn rem_euclid(self, rhs: Self) -> Self
pub fn rem_euclid(self, rhs: Self) -> Self
Calculates the least remainder of self (mod rhs).
Since, for the positive integers, all common
definitions of division are equal, this
is exactly equal to self % rhs.
§Panics
This function will panic if rhs is zero.
See u128::rem_euclid.
Sourcepub fn div_floor(self, rhs: Self) -> Self
pub fn div_floor(self, rhs: Self) -> Self
Calculates the quotient of self and rhs, rounding the result towards
negative infinity.
This is the same as performing self / rhs for all unsigned integers.
§Panics
This function will panic if rhs is zero.
See u128::div_floor.
Sourcepub fn div_ceil(self, rhs: Self) -> Self
pub fn div_ceil(self, rhs: Self) -> Self
Calculates the quotient of self and rhs, rounding the result towards
positive infinity.
§Panics
This function will panic if rhs is zero.
See u128::div_ceil.
Sourcepub fn ilog(self, base: Self) -> u32
pub fn ilog(self, base: Self) -> u32
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
This method might not be optimized owing to implementation details;
ilog2 can produce results more efficiently for base 2, and ilog10
can produce results more efficiently for base 10.
§Panics
This function will panic if self is zero, or if base is less than 2.
See u128::ilog.
Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns the base 2 logarithm of the number, rounded down.
§Panics
This function will panic if self is zero.
See u128::ilog2.
Sourcepub const fn abs_diff(self, other: Self) -> Self
pub const fn abs_diff(self, other: Self) -> Self
Computes the absolute difference between self and other.
See u128::abs_diff.
Sourcepub fn next_multiple_of(self, rhs: Self) -> Self
pub fn next_multiple_of(self, rhs: Self) -> Self
Calculates the smallest value greater than or equal to self that
is a multiple of rhs.
§Panics
This function will panic if rhs is zero.
§Overflow behavior
On overflow, this function will panic if overflow checks are enabled (default in debug mode) and wrap if overflow checks are disabled (default in release mode).
Sourcepub fn is_multiple_of(self, rhs: Self) -> bool
pub fn is_multiple_of(self, rhs: Self) -> bool
Returns true if self is an integer multiple of rhs, and false
otherwise.
This function is equivalent to self % rhs == 0, except that it will
not panic for rhs == 0. Instead, 0.is_multiple_of(0) == true,
and for any non-zero n, n.is_multiple_of(0) == false.
Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == 2^k for some k.
Sourcepub const fn next_power_of_two(self) -> Self
pub const fn next_power_of_two(self) -> Self
Returns the smallest power of two greater than or equal to self.
When return value overflows (i.e., self > (1 << (N-1)) for type
uN), it panics in debug mode and the return value is wrapped to 0 in
release mode (the only situation in which this method can return 0).
Sourcepub const fn midpoint(self, rhs: Self) -> Self
pub const fn midpoint(self, rhs: Self) -> Self
Calculates the middle point of self and rhs.
midpoint(a, b) is (a + b) / 2 as if it were performed in a
sufficiently-large unsigned integral type. This implies that the result
is always rounded towards zero and that no overflow will ever occur.
See u128::midpoint.
Sourcepub const fn widening_mul(self, rhs: Self) -> (Self, Self)
pub const fn widening_mul(self, rhs: Self) -> (Self, Self)
Calculates the complete product self * rhs without the possibility to overflow.
This returns the low-order (wrapping) bits and the high-order (overflow) bits of the result as two separate values, in that order.
If you also need to add a carry to the wide result, then you want
Self::carrying_mul instead.
§Examples
Basic usage:
Please note that this example is shared between integer types.
Which explains why u32 is used here.
#![feature(bigint_helper_methods)]
assert_eq!(5u32.widening_mul(2), (10, 0));
assert_eq!(1_000_000_000u32.widening_mul(10), (1410065408, 2));See u64::widening_mul.
Sourcepub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
pub const fn carrying_mul(self, rhs: Self, carry: Self) -> (Self, Self)
Calculates the “full multiplication” self * rhs + carry
without the possibility to overflow.
This returns the low-order (wrapping) bits and the high-order (overflow) bits of the result as two separate values, in that order.
Performs “long multiplication” which takes in an extra amount to add, and may return an additional amount of overflow. This allows for chaining together multiple multiplications to create “big integers” which represent larger values.
If you don’t need the carry, then you can use Self::widening_mul instead.
Sourcepub const fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)
pub const fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool)
Calculates self + rhs + carry and returns a tuple containing
the sum and the output carry.
Performs “ternary addition” of two integer operands and a carry-in bit, and returns an output integer and a carry-out bit. This allows chaining together multiple additions to create a wider addition, and can be useful for bignum addition.
See u128::carrying_add.
Sourcepub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool)
pub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool)
Calculates self − rhs − borrow and returns a tuple
containing the difference and the output borrow.
Performs “ternary subtraction” by subtracting both an integer
operand and a borrow-in bit from self, and returns an output
integer and a borrow-out bit. This allows chaining together multiple
subtractions to create a wider subtraction, and can be useful for
bignum subtraction.
See u128::borrowing_sub.
Sourcepub const fn wrapping_pow(self, exp: u32) -> Self
pub const fn wrapping_pow(self, exp: u32) -> Self
Wrapping (modular) exponentiation. Computes self.pow(exp),
wrapping around at the boundary of the type.
See u128::wrapping_pow.
Sourcepub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_add(self, rhs: Self) -> Self
Wrapping (modular) addition. Computes self + rhs,
wrapping around at the boundary of the type.
See u128::wrapping_add.
Sourcepub const fn wrapping_add_signed(self, rhs: I512) -> Self
pub const fn wrapping_add_signed(self, rhs: I512) -> Self
Wrapping (modular) addition with a signed integer. Computes
self + rhs, wrapping around at the boundary of the type.
Sourcepub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
Wrapping (modular) subtraction. Computes self - rhs,
wrapping around at the boundary of the type.
See u128::wrapping_sub.
Sourcepub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary of the type.
Many different algorithms were attempted, with a soft mulx approach
(1), a flat, fixed-width long multiplication (2), and a
short-circuiting long multiplication (3). Algorithm (3) had the best
performance for 128-bit multiplication, however, algorithm (1) was
better for smaller type sizes.
This also optimized much better when multiplying by a single or a
half-sized item: rather than using 4 limbs, if we’re multiplying
(u128, u128) * u128, we can use 2 limbs for the right operand, and
for (u128, u128) * u64, only
§Assembly
For a 128-bit multiplication (2x u64 + 2x u64), algorithm (1) had
6 mul, 6 add, and 6 bitshift instructions. Algorithm (3) had 10
mul, 12 add, and 12 bitshift instructions in the worst case, with
a minimum of 4 mul and 2 add instructions, along with a lot of
branching. That is, it was almost never worth it.
However, for 256-bit multiplication, the switch flips, with algorithm
(1) having 10 mul and 14 add instructions. However, algorithm (3)
has in the worst case 10 mul and 13 add instructions, however,
because of branching in nearly every case, it has better performance
and optimizes nicely for small multiplications.
See u128::wrapping_mul.
Sourcepub fn wrapping_div_rem(self, n: Self) -> (Self, Self)
pub fn wrapping_div_rem(self, n: Self) -> (Self, Self)
Get the quotient and remainder of our big integer divided by a signed limb, wrapping on overflow.
This allows storing of both the quotient and remainder without making repeated calls.
§Panics
This panics if the divisor is 0.
Sourcepub fn wrapping_div(self, rhs: Self) -> Self
pub fn wrapping_div(self, rhs: Self) -> Self
Wrapping (modular) division. Computes self / rhs.
Wrapped division on unsigned types is just normal division. There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations.
§Panics
This function will panic if rhs is zero.
See u128::wrapping_div.
Sourcepub fn wrapping_div_euclid(self, rhs: Self) -> Self
pub fn wrapping_div_euclid(self, rhs: Self) -> Self
Wrapping Euclidean division. Computes self.div_euclid(rhs).
Wrapped division on unsigned types is just normal division. There’s
no way wrapping could ever happen. This function exists so that all
operations are accounted for in the wrapping operations. Since, for
the positive integers, all common definitions of division are equal,
this is exactly equal to self.wrapping_div(rhs).
§Panics
This function will panic if rhs is zero.
Sourcepub fn wrapping_rem(self, rhs: Self) -> Self
pub fn wrapping_rem(self, rhs: Self) -> Self
Wrapping (modular) remainder. Computes self % rhs.
Wrapped remainder calculation on unsigned types is just the regular remainder calculation. There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations.
§Panics
This function will panic if rhs is zero.
See u128::wrapping_rem.
Sourcepub fn wrapping_rem_euclid(self, rhs: Self) -> Self
pub fn wrapping_rem_euclid(self, rhs: Self) -> Self
Wrapping Euclidean modulo. Computes self.rem_euclid(rhs).
Wrapped modulo calculation on unsigned types is just the regular
remainder calculation. There’s no way wrapping could ever happen.
This function exists so that all operations are accounted for in the
wrapping operations. Since, for the positive integers, all common
definitions of division are equal, this is exactly equal to
self.wrapping_rem(rhs).
§Panics
This function will panic if rhs is zero.
Sourcepub const fn wrapping_neg(self) -> Self
pub const fn wrapping_neg(self) -> Self
Wrapping (modular) negation. Computes -self,
wrapping around at the boundary of the type.
Since unsigned types do not have negative equivalents
all applications of this function will wrap (except for -0).
For values smaller than the corresponding signed type’s maximum
the result is the same as casting the corresponding signed value.
Any larger values are equivalent to MAX + 1 - (val - MAX - 1) where
MAX is the corresponding signed type’s maximum.
See u128::wrapping_neg.
Sourcepub const fn wrapping_next_power_of_two(self) -> Self
pub const fn wrapping_next_power_of_two(self) -> Self
Returns the smallest power of two greater than or equal to n. If
the next power of two is greater than the type’s maximum value,
the return value is wrapped to 0.
Sourcepub const fn overflowing_pow(self, exp: u32) -> (Self, bool)
pub const fn overflowing_pow(self, exp: u32) -> (Self, bool)
Raises self to the power of exp, using exponentiation by squaring,
returning the value.
Returns a tuple of the exponentiation along with a bool indicating whether an overflow happened.
Sourcepub fn overflowing_div_rem(self, n: Self) -> ((Self, Self), bool)
pub fn overflowing_div_rem(self, n: Self) -> ((Self, Self), bool)
Get the quotient and remainder of our big integer division, returning the value and if overflow occurred.
This allows storing of both the quotient and remainder without making repeated calls.
§Panics
This function will panic if rhs is zero.
Sourcepub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
Calculates self + rhs.
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Sourcepub const fn overflowing_add_signed(self, rhs: I512) -> (Self, bool)
pub const fn overflowing_add_signed(self, rhs: I512) -> (Self, bool)
Calculates self + rhs with a signed rhs.
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Sourcepub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
Calculates self - rhs.
Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Sourcepub const fn overflowing_sub_signed(self, rhs: I512) -> (Self, bool)
pub const fn overflowing_sub_signed(self, rhs: I512) -> (Self, bool)
Calculates self - rhs with a signed rhs
Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Sourcepub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
Calculates the multiplication of self and rhs.
Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Many different algorithms were attempted, with a soft mulx approach
(1), a flat, fixed-width long multiplication (2), and a
short-circuiting long multiplication (3). Algorithm (3) had the best
performance for 128-bit multiplication, however, algorithm (1) was
better for smaller type sizes.
This also optimized much better when multiplying by a single or a
half-sized item: rather than using 4 limbs, if we’re multiplying
(u128, u128) * u128, we can use 2 limbs for the right operand, and
for (u128, u128) * u64, only 1 limb.
§Assembly
The analysis here is practically identical to that of wrapping_mul.
Sourcepub fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub fn overflowing_div(self, rhs: Self) -> (Self, bool)
Calculates the divisor when self is divided by rhs.
Returns a tuple of the divisor along with a boolean indicating
whether an arithmetic overflow would occur. Note that for unsigned
integers overflow never occurs, so the second value is always
false.
§Panics
This function will panic if rhs is zero.
Sourcepub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
Calculates the quotient of Euclidean division self.div_euclid(rhs).
Returns a tuple of the divisor along with a boolean indicating
whether an arithmetic overflow would occur. Note that for unsigned
integers overflow never occurs, so the second value is always
false.
Since, for the positive integers, all common
definitions of division are equal, this
is exactly equal to self.overflowing_div(rhs).
§Panics
This function will panic if rhs is zero.
Sourcepub fn overflowing_rem(self, rhs: Self) -> (Self, bool)
pub fn overflowing_rem(self, rhs: Self) -> (Self, bool)
Calculates the remainder when self is divided by rhs.
Returns a tuple of the remainder after dividing along with a boolean
indicating whether an arithmetic overflow would occur. Note that for
unsigned integers overflow never occurs, so the second value is
always false.
§Panics
This function will panic if rhs is zero.
Sourcepub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)
pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)
Calculates the remainder self.rem_euclid(rhs) as if by Euclidean
division.
Returns a tuple of the modulo after dividing along with a boolean
indicating whether an arithmetic overflow would occur. Note that for
unsigned integers overflow never occurs, so the second value is
always false.
Since, for the positive integers, all common
definitions of division are equal, this operation
is exactly equal to self.overflowing_rem(rhs).
§Panics
This function will panic if rhs is zero.
Sourcepub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
Saturating integer addition. Computes self + rhs, saturating at
the numeric bounds instead of overflowing.
See u128::saturating_add.
Sourcepub const fn saturating_add_signed(self, rhs: I512) -> Self
pub const fn saturating_add_signed(self, rhs: I512) -> Self
Saturating addition with a signed integer. Computes self + rhs,
saturating at the numeric bounds instead of overflowing.
See u128::saturating_add_signed.
Sourcepub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
Saturating integer subtraction. Computes self - rhs, saturating
at the numeric bounds instead of overflowing.
See u128::saturating_sub.
Sourcepub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
Saturating integer multiplication. Computes self * rhs,
saturating at the numeric bounds instead of overflowing.
See u128::saturating_mul.
Sourcepub fn saturating_div(self, rhs: Self) -> Self
pub fn saturating_div(self, rhs: Self) -> Self
Saturating integer division. Computes self / rhs, saturating at the
numeric bounds instead of overflowing.
§Panics
This function will panic if rhs is zero.
See u128::saturating_div.
Sourcepub const fn saturating_pow(self, exp: u32) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
Saturating integer exponentiation. Computes self.pow(exp),
saturating at the numeric bounds instead of overflowing.
See u128::saturating_pow.
Sourcepub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_add(self, rhs: Self) -> Option<Self>
Checked integer addition. Computes self + rhs, returning None
if overflow occurred.
See u128::checked_add.
Sourcepub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs, returning None
if overflow occurred.
See u128::checked_sub.
Sourcepub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
Checked integer multiplication. Computes self * rhs, returning None
if overflow occurred.
See u128::checked_mul.
Sourcepub const fn checked_pow(self, base: u32) -> Option<Self>
pub const fn checked_pow(self, base: u32) -> Option<Self>
Checked exponentiation. Computes self.pow(exp), returning None
if overflow occurred.
See u128::checked_pow.
Sourcepub fn checked_div_rem(self, n: Self) -> Option<(Self, Self)>
pub fn checked_div_rem(self, n: Self) -> Option<(Self, Self)>
Checked integer division. Computes self / rhs, returning None
rhs == 0 or the division results in overflow (signed only).
This allows storing of both the quotient and remainder without making repeated calls.
Sourcepub fn checked_div(self, rhs: Self) -> Option<Self>
pub fn checked_div(self, rhs: Self) -> Option<Self>
Checked integer division. Computes self / rhs, returning None
rhs == 0 or the division results in overflow (signed only).
See u128::checked_div.
Sourcepub fn checked_rem(self, rhs: Self) -> Option<Self>
pub fn checked_rem(self, rhs: Self) -> Option<Self>
Checked integer division. Computes self % rhs, returning None
rhs == 0 or the division results in overflow (signed only).
See u128::checked_rem.
Sourcepub fn checked_div_euclid(self, rhs: Self) -> Option<Self>
pub fn checked_div_euclid(self, rhs: Self) -> Option<Self>
Checked Euclidean division. Computes self.div_euclid(rhs),
returning None if rhs == 0 or the division results in
overflow (signed only).
Sourcepub fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
pub fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
Checked Euclidean modulo. Computes self.rem_euclid(rhs),
returning None if rhs == 0 or the division results in
overflow (signed only).
Sourcepub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
Checked shift left. Computes self << rhs, returning None if rhs is
larger than or equal to the number of bits in self.
See u128::checked_shl.
Sourcepub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
Checked shift right. Computes self >> rhs, returning None if rhs
is larger than or equal to the number of bits in self.
See u128::checked_shr.
Sourcepub const fn checked_ilog2(self) -> Option<u32>
pub const fn checked_ilog2(self) -> Option<u32>
Returns the base 2 logarithm of the number, rounded down.
Returns None if the number is negative or zero.
See u128::checked_ilog2.
Sourcepub const fn checked_add_signed(self, rhs: I512) -> Option<Self>
pub const fn checked_add_signed(self, rhs: I512) -> Option<Self>
Checked addition with a signed integer. Computes self + rhs,
returning None if overflow occurred.
See u128::checked_add_signed.
Sourcepub const fn checked_neg(self) -> Option<Self>
pub const fn checked_neg(self) -> Option<Self>
Checked negation. Computes -self, returning None unless self == 0.
Note that negating any positive integer will overflow.
See u128::checked_neg.
Sourcepub fn checked_ilog(self, base: Self) -> Option<u32>
pub fn checked_ilog(self, base: Self) -> Option<u32>
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
Returns None if the number is zero, or if the base is not at least 2.
This method might not be optimized owing to implementation details;
checked_ilog2 can produce results more efficiently for base 2, and
checked_ilog10 can produce results more efficiently for base 10.
See u128::checked_ilog.
Sourcepub fn checked_next_multiple_of(self, rhs: Self) -> Option<Self>
pub fn checked_next_multiple_of(self, rhs: Self) -> Option<Self>
Calculates the smallest value greater than or equal to self that
is a multiple of rhs. Returns None if rhs is zero or the
operation would result in overflow.
See u128::checked_next_multiple_of.
Sourcepub const fn checked_signed_diff(self, rhs: Self) -> Option<I512>
pub const fn checked_signed_diff(self, rhs: Self) -> Option<I512>
Checked subtraction with a signed integer. Computes self - rhs,
returning None if overflow occurred.
Sourcepub const fn checked_next_power_of_two(self) -> Option<Self>
pub const fn checked_next_power_of_two(self) -> Option<Self>
Returns the smallest power of two greater than or equal to self. If
the next power of two is greater than the type’s maximum value,
None is returned, otherwise the power of two is wrapped in Some.
See u128::checked_next_power_of_two.
Sourcepub const fn strict_add(self, rhs: Self) -> Self
pub const fn strict_add(self, rhs: Self) -> Self
Strict integer addition. Computes self + rhs, panicking
if overflow occurred.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether overflow checks are enabled.
See u128::strict_add.
Sourcepub const fn strict_sub(self, rhs: Self) -> Self
pub const fn strict_sub(self, rhs: Self) -> Self
Strict integer subtraction. Computes self - rhs, panicking if
overflow occurred.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether overflow checks are enabled.
See u128::strict_sub.
Sourcepub const fn strict_mul(self, rhs: Self) -> Self
pub const fn strict_mul(self, rhs: Self) -> Self
Strict integer multiplication. Computes self * rhs, panicking if
overflow occurred.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether overflow checks are enabled.
See u128::strict_mul.
Sourcepub const fn strict_pow(self, rhs: u32) -> Self
pub const fn strict_pow(self, rhs: u32) -> Self
Strict exponentiation. Computes self.pow(exp), panicking if
overflow occurred.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether overflow checks are enabled.
See u128::strict_pow.
Sourcepub const fn strict_shl(self, rhs: u32) -> Self
pub const fn strict_shl(self, rhs: u32) -> Self
Strict shift left. Computes self << rhs, panicking if rhs is larger
than or equal to the number of bits in self.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether overflow checks are enabled.
See u128::strict_shl.
Sourcepub const fn strict_shr(self, rhs: u32) -> Self
pub const fn strict_shr(self, rhs: u32) -> Self
Strict shift right. Computes self >> rhs, panicking rhs is
larger than or equal to the number of bits in self.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether overflow checks are enabled.
See u128::strict_shr.
Sourcepub const fn strict_add_signed(self, rhs: I512) -> Self
pub const fn strict_add_signed(self, rhs: I512) -> Self
Strict addition with a signed integer. Computes self + rhs,
panicking if overflow occurred.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether
overflow checks are enabled.
See u128::strict_add_signed.
Sourcepub fn strict_div(self, rhs: Self) -> Self
pub fn strict_div(self, rhs: Self) -> Self
Strict integer division. Computes self / rhs.
Strict division on unsigned types is just normal division. There’s no way overflow could ever happen. This function exists so that all operations are accounted for in the strict operations.
§Panics
This function will panic if rhs is zero.
See u128::strict_div.
Sourcepub fn strict_rem(self, rhs: Self) -> Self
pub fn strict_rem(self, rhs: Self) -> Self
Strict integer remainder. Computes self % rhs.
Strict remainder calculation on unsigned types is just the regular remainder calculation. There’s no way overflow could ever happen. This function exists so that all operations are accounted for in the strict operations.
§Panics
This function will panic if rhs is zero.
See u128::strict_rem.
Sourcepub fn strict_div_euclid(self, rhs: Self) -> Self
pub fn strict_div_euclid(self, rhs: Self) -> Self
Strict Euclidean division. Computes self.div_euclid(rhs).
Strict division on unsigned types is just normal division. There’s no
way overflow could ever happen. This function exists so that all
operations are accounted for in the strict operations. Since, for the
positive integers, all common definitions of division are equal, this
is exactly equal to self.strict_div(rhs).
§Panics
This function will panic if rhs is zero.
See u128::strict_div_euclid.
Sourcepub fn strict_rem_euclid(self, rhs: Self) -> Self
pub fn strict_rem_euclid(self, rhs: Self) -> Self
Strict Euclidean modulo. Computes self.rem_euclid(rhs).
Strict modulo calculation on unsigned types is just the regular
remainder calculation. There’s no way overflow could ever happen.
This function exists so that all operations are accounted for in the
strict operations. Since, for the positive integers, all common
definitions of division are equal, this is exactly equal to
self.strict_rem(rhs).
§Panics
This function will panic if rhs is zero.
See u128::strict_rem_euclid.
Sourcepub const fn strict_neg(self) -> Self
pub const fn strict_neg(self) -> Self
Strict negation. Computes -self, panicking unless self == 0.
Note that negating any positive integer will overflow.
§Panics
§Overflow behavior
This function will always panic on overflow, regardless of whether
overflow checks are enabled.
See u128::strict_neg.
Sourcepub unsafe fn unchecked_add(self, rhs: Self) -> Self
pub unsafe fn unchecked_add(self, rhs: Self) -> Self
Unchecked integer addition. Computes self + rhs, assuming overflow
cannot occur.
Calling x.unchecked_add(y) is semantically equivalent to calling
x.checked_add(y).unwrap_unchecked().
If you’re just trying to avoid the panic in debug mode, then do not
use this. Instead, you’re looking for wrapping_add.
This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
§Safety
This results in undefined behavior when the value overflows.
See u128::unchecked_add.
Sourcepub unsafe fn unchecked_sub(self, rhs: Self) -> Self
pub unsafe fn unchecked_sub(self, rhs: Self) -> Self
Unchecked integer subtraction. Computes self - rhs, assuming overflow
cannot occur.
Calling x.unchecked_sub(y) is semantically equivalent to calling
x.checked_sub(y).unwrap_unchecked().
If you’re just trying to avoid the panic in debug mode, then do not
use this. Instead, you’re looking for wrapping_sub.
This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
§Safety
This results in undefined behavior when the value overflows.
See u128::unchecked_sub.
Sourcepub const unsafe fn unchecked_mul(self, rhs: Self) -> Self
pub const unsafe fn unchecked_mul(self, rhs: Self) -> Self
Unchecked integer multiplication. Computes self * rhs, assuming
overflow cannot occur.
Calling x.unchecked_mul(y) is semantically equivalent to calling
x.checked_mul(y).unwrap_unchecked().
If you’re just trying to avoid the panic in debug mode, then do not
use this. Instead, you’re looking for wrapping_mul.
This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
§Safety
This results in undefined behavior when the value overflows.
See u128::unchecked_mul.
Sourcepub const unsafe fn unchecked_shl(self, rhs: u32) -> Self
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self
Unchecked shift left. Computes self << rhs, assuming that
rhs is less than the number of bits in self.
This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
§Safety
This results in undefined behavior if rhs is larger than
or equal to the number of bits in self,
i.e. when checked_shl would return None.
See u128::unchecked_shl.
Sourcepub const unsafe fn unchecked_shr(self, rhs: u32) -> Self
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self
Unchecked shift right. Computes self >> rhs, assuming that
rhs is less than the number of bits in self.
This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
§Safety
This results in undefined behavior if rhs is larger than
or equal to the number of bits in self,
i.e. when checked_shr would return None.
See u128::unchecked_shr.
Sourcepub const fn unbounded_shl(self, rhs: u32) -> Self
pub const fn unbounded_shl(self, rhs: u32) -> Self
Unbounded shift left. Computes self << rhs, without bounding the value
of rhs.
If rhs is larger or equal to the number of bits in self,
the entire value is shifted out, and 0 is returned.
Sourcepub const fn unbounded_shr(self, rhs: u32) -> Self
pub const fn unbounded_shr(self, rhs: u32) -> Self
Unbounded shift right. Computes self >> rhs, without bounding the
value of rhs.
If rhs is larger or equal to the number of bits in self,
the entire value is shifted out, and 0 is returned.
Sourcepub const fn add_ulimb(self, n: ULimb) -> Self
pub const fn add_ulimb(self, n: ULimb) -> Self
Add an unsigned limb to the big integer.
This allows optimizations a full addition cannot do.
Sourcepub const fn sub_ulimb(self, n: ULimb) -> Self
pub const fn sub_ulimb(self, n: ULimb) -> Self
Subtract an unsigned limb from the big integer.
This allows optimizations a full subtraction cannot do.
Sourcepub const fn mul_ulimb(self, n: ULimb) -> Self
pub const fn mul_ulimb(self, n: ULimb) -> Self
Multiply our big integer by an unsigned limb.
This allows optimizations a full multiplication cannot do.
Sourcepub fn div_rem_ulimb(self, n: ULimb) -> (Self, ULimb)
pub fn div_rem_ulimb(self, n: ULimb) -> (Self, ULimb)
Get the quotient and remainder of our big integer divided by an unsigned limb.
This allows optimizations a full division cannot do.
§Panics
This panics if the divisor is 0.
Sourcepub fn div_ulimb(self, n: ULimb) -> Self
pub fn div_ulimb(self, n: ULimb) -> Self
Get the quotient of our big integer divided by an unsigned limb.
This allows optimizations a full division cannot do.
Sourcepub fn rem_ulimb(self, n: ULimb) -> ULimb
pub fn rem_ulimb(self, n: ULimb) -> ULimb
Get the remainder of our big integer divided by an unsigned limb.
This allows optimizations a full division cannot do.
Sourcepub fn wrapping_div_ulimb(self, n: ULimb) -> Self
pub fn wrapping_div_ulimb(self, n: ULimb) -> Self
Get the quotient of our big integer divided by an unsigned limb, wrapping on overflow.
This allows optimizations a full division cannot do.
Sourcepub fn wrapping_rem_ulimb(self, n: ULimb) -> ULimb
pub fn wrapping_rem_ulimb(self, n: ULimb) -> ULimb
Get the remainder of our big integer divided by an unsigned limb, wrapping on overflow.
This allows optimizations a full division cannot do.
Sourcepub const fn wrapping_add_ulimb(self, n: ULimb) -> Self
pub const fn wrapping_add_ulimb(self, n: ULimb) -> Self
Add an unsigned limb to the big integer, wrapping on overflow.
This allows optimizations a full addition cannot do.
Sourcepub const fn wrapping_sub_ulimb(self, n: ULimb) -> Self
pub const fn wrapping_sub_ulimb(self, n: ULimb) -> Self
Subtract an unsigned limb from the big integer, wrapping on overflow.
This allows optimizations a full subtraction cannot do.
Sourcepub const fn wrapping_mul_ulimb(self, n: ULimb) -> Self
pub const fn wrapping_mul_ulimb(self, n: ULimb) -> Self
Multiply our big integer by an unsigned limb, wrapping on overflow.
This allows optimizations a full multiplication cannot do.
Many different algorithms were attempted, with a soft mulx approach
(1), a flat, fixed-width long multiplication (2), and a
short-circuiting long multiplication (3). Algorithm (3) had the best
performance for 128-bit multiplication, however, algorithm (1) was
better for smaller type sizes.
This also optimized much better when multiplying by a single or a
half-sized item: rather than using 4 limbs, if we’re multiplying
(u128, u128) * u128, we can use 2 limbs for the right operand, and
for (u128, u128) * u64, only 1 limb.
Using algorithm (3), the addition of (u128, u128) + (u128, u128) is in
the worst case 10 mul and 13 add instructions, while (u128, u128) + u64 is always 4 mul and 3 add instructions without any
branching. This is extremely efficient.
Sourcepub fn wrapping_div_rem_ulimb(self, n: ULimb) -> (Self, ULimb)
pub fn wrapping_div_rem_ulimb(self, n: ULimb) -> (Self, ULimb)
Get the quotient and remainder of our big integer divided by an unsigned limb, wrapping on overflow.
This allows optimizations a full division cannot do.
§Panics
This panics if the divisor is 0.
Sourcepub fn overflowing_div_rem_ulimb(self, n: ULimb) -> ((Self, ULimb), bool)
pub fn overflowing_div_rem_ulimb(self, n: ULimb) -> ((Self, ULimb), bool)
Get the quotient and remainder of our big integer divided by an unsigned limb, returning the value and if overflow occurred.
This allows optimizations a full division cannot do.
Sourcepub fn overflowing_div_ulimb(self, n: ULimb) -> (Self, bool)
pub fn overflowing_div_ulimb(self, n: ULimb) -> (Self, bool)
Get the quotient of our big integer divided by an unsigned limb, returning the value and if overflow occurred.
This allows optimizations a full division cannot do.
Sourcepub fn overflowing_rem_ulimb(self, n: ULimb) -> (ULimb, bool)
pub fn overflowing_rem_ulimb(self, n: ULimb) -> (ULimb, bool)
Get the remainder of our big integer divided by an unsigned limb, returning the value and if overflow occurred.
This allows optimizations a full division cannot do.
Sourcepub const fn overflowing_add_ulimb(self, n: ULimb) -> (Self, bool)
pub const fn overflowing_add_ulimb(self, n: ULimb) -> (Self, bool)
Add an unsigned limb to the big integer, returning the value and if overflow occurred.
This allows optimizations a full addition cannot do.
Sourcepub const fn overflowing_sub_ulimb(self, n: ULimb) -> (Self, bool)
pub const fn overflowing_sub_ulimb(self, n: ULimb) -> (Self, bool)
Subtract an unsigned limb from the big integer, returning the value and if overflow occurred.
This allows optimizations a full subtraction cannot do.
Sourcepub const fn overflowing_mul_ulimb(self, n: ULimb) -> (Self, bool)
pub const fn overflowing_mul_ulimb(self, n: ULimb) -> (Self, bool)
Multiply our big integer by an unsigned limb, returning the value and if overflow occurred.
Many different algorithms were attempted, with a soft mulx approach
(1), a flat, fixed-width long multiplication (2), and a
short-circuiting long multiplication (3). Algorithm (3) had the best
performance for 128-bit multiplication, however, algorithm (1) was
better for smaller type sizes.
This also optimized much better when multiplying by a single or a
half-sized item: rather than using 4 limbs, if we’re multiplying
(u128, u128) * u128, we can use 2 limbs for the right operand, and
for (u128, u128) * u64, only 1 limb.
§Assembly
The analysis here is practically identical to that of
wrapping_mul_ulimb.
Sourcepub const fn checked_add_ulimb(self, n: ULimb) -> Option<Self>
pub const fn checked_add_ulimb(self, n: ULimb) -> Option<Self>
Add an unsigned limb to the big integer, returning None on overflow.
This allows optimizations a full addition cannot do.
Sourcepub const fn checked_sub_ulimb(self, n: ULimb) -> Option<Self>
pub const fn checked_sub_ulimb(self, n: ULimb) -> Option<Self>
Subtract an unsigned limb from the big integer, returning None on overflow.
This allows optimizations a full addition cannot do.
Sourcepub const fn checked_mul_ulimb(self, n: ULimb) -> Option<Self>
pub const fn checked_mul_ulimb(self, n: ULimb) -> Option<Self>
Multiply our big integer by an unsigned limb, returning None on overflow.
This allows optimizations a full multiplication cannot do.
Sourcepub fn checked_div_rem_ulimb(self, n: ULimb) -> Option<(Self, ULimb)>
pub fn checked_div_rem_ulimb(self, n: ULimb) -> Option<(Self, ULimb)>
Get the quotient of our big integer divided by an unsigned limb, returning None on overflow or division by 0.
This allows optimizations a full division cannot do.
Sourcepub fn checked_div_ulimb(self, n: ULimb) -> Option<Self>
pub fn checked_div_ulimb(self, n: ULimb) -> Option<Self>
Get the quotient of our big integer divided by an unsigned limb, returning None on overflow or division by 0.
This allows optimizations a full division cannot do.
Sourcepub fn checked_rem_ulimb(self, n: ULimb) -> Option<ULimb>
pub fn checked_rem_ulimb(self, n: ULimb) -> Option<ULimb>
Get the remainder of our big integer divided by a signed limb, returning None on overflow or division by 0.
This allows optimizations a full division cannot do.
Sourcepub const fn from_str_radix(
src: &str,
radix: u32,
) -> Result<Self, ParseIntError>
pub const fn from_str_radix( src: &str, radix: u32, ) -> Result<Self, ParseIntError>
Converts a string slice in a given base to an integer.
The string is expected to be an optional +
sign followed by only digits. Leading and trailing non-digit characters
(including whitespace) represent an error. Underscores (which are
accepted in rust literals) also represent an error.
Digits are a subset of these characters, depending on radix:
0-9a-zA-Z
This only has rudimentary optimizations.
§Panics
This function panics if radix is not in the range from 2 to 36.
Sourcepub fn to_str_radix(self, buffer: &mut [u8], radix: u32) -> &[u8] ⓘ
pub fn to_str_radix(self, buffer: &mut [u8], radix: u32) -> &[u8] ⓘ
Write the integer to bytes for the given integer.
Digits are a subset of these characters, depending on radix:
0-9a-zA-Z
This only has rudimentary optimizations.
§Panics
This function panics if radix is not in the range from 2 to 36,
or the buffer isn’t large enough to hold the significant digits.
Trait Implementations§
Source§impl AddAssign<&U512> for U512
impl AddAssign<&U512> for U512
Source§fn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
+= operation. Read moreSource§impl AddAssign for U512
impl AddAssign for U512
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+= operation. Read moreSource§impl BitAndAssign<&U512> for U512
impl BitAndAssign<&U512> for U512
Source§fn bitand_assign(&mut self, other: &Self)
fn bitand_assign(&mut self, other: &Self)
&= operation. Read moreSource§impl BitAndAssign for U512
impl BitAndAssign for U512
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
&= operation. Read moreSource§impl BitOrAssign<&U512> for U512
impl BitOrAssign<&U512> for U512
Source§fn bitor_assign(&mut self, other: &Self)
fn bitor_assign(&mut self, other: &Self)
|= operation. Read moreSource§impl BitOrAssign for U512
impl BitOrAssign for U512
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|= operation. Read moreSource§impl BitXorAssign<&U512> for U512
impl BitXorAssign<&U512> for U512
Source§fn bitxor_assign(&mut self, other: &Self)
fn bitxor_assign(&mut self, other: &Self)
^= operation. Read moreSource§impl BitXorAssign for U512
impl BitXorAssign for U512
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
^= operation. Read moreSource§impl DivAssign<&U512> for U512
impl DivAssign<&U512> for U512
Source§fn div_assign(&mut self, other: &Self)
fn div_assign(&mut self, other: &Self)
/= operation. Read moreSource§impl DivAssign for U512
impl DivAssign for U512
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
/= operation. Read moreSource§impl FromStr for U512
impl FromStr for U512
Source§fn from_str(src: &str) -> Result<Self, ParseIntError>
fn from_str(src: &str) -> Result<Self, ParseIntError>
Parses a string s to return a value of this type.
This is not optimized, since all optimization is done in the lexical implementation.
Source§type Err = ParseIntError
type Err = ParseIntError
Source§impl MulAssign<&U512> for U512
impl MulAssign<&U512> for U512
Source§fn mul_assign(&mut self, other: &Self)
fn mul_assign(&mut self, other: &Self)
*= operation. Read moreSource§impl MulAssign for U512
impl MulAssign for U512
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
*= operation. Read moreSource§impl Ord for U512
impl Ord for U512
Source§impl PartialOrd for U512
impl PartialOrd for U512
Source§impl RemAssign<&U512> for U512
impl RemAssign<&U512> for U512
Source§fn rem_assign(&mut self, other: &Self)
fn rem_assign(&mut self, other: &Self)
%= operation. Read moreSource§impl RemAssign for U512
impl RemAssign for U512
Source§fn rem_assign(&mut self, other: Self)
fn rem_assign(&mut self, other: Self)
%= operation. Read moreSource§impl ShlAssign<&I512> for U512
impl ShlAssign<&I512> for U512
Source§fn shl_assign(&mut self, other: &I512)
fn shl_assign(&mut self, other: &I512)
<<= operation. Read moreSource§impl ShlAssign<&U512> for I512
impl ShlAssign<&U512> for I512
Source§fn shl_assign(&mut self, other: &U512)
fn shl_assign(&mut self, other: &U512)
<<= operation. Read moreSource§impl ShlAssign<&i128> for U512
impl ShlAssign<&i128> for U512
Source§fn shl_assign(&mut self, other: &i128)
fn shl_assign(&mut self, other: &i128)
<<= operation. Read moreSource§impl ShlAssign<&i16> for U512
impl ShlAssign<&i16> for U512
Source§fn shl_assign(&mut self, other: &i16)
fn shl_assign(&mut self, other: &i16)
<<= operation. Read moreSource§impl ShlAssign<&i32> for U512
impl ShlAssign<&i32> for U512
Source§fn shl_assign(&mut self, other: &i32)
fn shl_assign(&mut self, other: &i32)
<<= operation. Read moreSource§impl ShlAssign<&i64> for U512
impl ShlAssign<&i64> for U512
Source§fn shl_assign(&mut self, other: &i64)
fn shl_assign(&mut self, other: &i64)
<<= operation. Read moreSource§impl ShlAssign<&i8> for U512
impl ShlAssign<&i8> for U512
Source§fn shl_assign(&mut self, other: &i8)
fn shl_assign(&mut self, other: &i8)
<<= operation. Read moreSource§impl ShlAssign<&isize> for U512
impl ShlAssign<&isize> for U512
Source§fn shl_assign(&mut self, other: &isize)
fn shl_assign(&mut self, other: &isize)
<<= operation. Read moreSource§impl ShlAssign<&u128> for U512
impl ShlAssign<&u128> for U512
Source§fn shl_assign(&mut self, other: &u128)
fn shl_assign(&mut self, other: &u128)
<<= operation. Read moreSource§impl ShlAssign<&u16> for U512
impl ShlAssign<&u16> for U512
Source§fn shl_assign(&mut self, other: &u16)
fn shl_assign(&mut self, other: &u16)
<<= operation. Read moreSource§impl ShlAssign<&u32> for U512
impl ShlAssign<&u32> for U512
Source§fn shl_assign(&mut self, other: &u32)
fn shl_assign(&mut self, other: &u32)
<<= operation. Read moreSource§impl ShlAssign<&u64> for U512
impl ShlAssign<&u64> for U512
Source§fn shl_assign(&mut self, other: &u64)
fn shl_assign(&mut self, other: &u64)
<<= operation. Read moreSource§impl ShlAssign<&u8> for U512
impl ShlAssign<&u8> for U512
Source§fn shl_assign(&mut self, other: &u8)
fn shl_assign(&mut self, other: &u8)
<<= operation. Read moreSource§impl ShlAssign<&usize> for U512
impl ShlAssign<&usize> for U512
Source§fn shl_assign(&mut self, other: &usize)
fn shl_assign(&mut self, other: &usize)
<<= operation. Read moreSource§impl ShlAssign<I512> for U512
impl ShlAssign<I512> for U512
Source§fn shl_assign(&mut self, other: I512)
fn shl_assign(&mut self, other: I512)
<<= operation. Read moreSource§impl ShlAssign<U512> for I512
impl ShlAssign<U512> for I512
Source§fn shl_assign(&mut self, other: U512)
fn shl_assign(&mut self, other: U512)
<<= operation. Read moreSource§impl ShlAssign<i128> for U512
impl ShlAssign<i128> for U512
Source§fn shl_assign(&mut self, other: i128)
fn shl_assign(&mut self, other: i128)
<<= operation. Read moreSource§impl ShlAssign<i16> for U512
impl ShlAssign<i16> for U512
Source§fn shl_assign(&mut self, other: i16)
fn shl_assign(&mut self, other: i16)
<<= operation. Read moreSource§impl ShlAssign<i32> for U512
impl ShlAssign<i32> for U512
Source§fn shl_assign(&mut self, other: i32)
fn shl_assign(&mut self, other: i32)
<<= operation. Read moreSource§impl ShlAssign<i64> for U512
impl ShlAssign<i64> for U512
Source§fn shl_assign(&mut self, other: i64)
fn shl_assign(&mut self, other: i64)
<<= operation. Read moreSource§impl ShlAssign<i8> for U512
impl ShlAssign<i8> for U512
Source§fn shl_assign(&mut self, other: i8)
fn shl_assign(&mut self, other: i8)
<<= operation. Read moreSource§impl ShlAssign<isize> for U512
impl ShlAssign<isize> for U512
Source§fn shl_assign(&mut self, other: isize)
fn shl_assign(&mut self, other: isize)
<<= operation. Read moreSource§impl ShlAssign<u128> for U512
impl ShlAssign<u128> for U512
Source§fn shl_assign(&mut self, other: u128)
fn shl_assign(&mut self, other: u128)
<<= operation. Read moreSource§impl ShlAssign<u16> for U512
impl ShlAssign<u16> for U512
Source§fn shl_assign(&mut self, other: u16)
fn shl_assign(&mut self, other: u16)
<<= operation. Read moreSource§impl ShlAssign<u32> for U512
impl ShlAssign<u32> for U512
Source§fn shl_assign(&mut self, other: u32)
fn shl_assign(&mut self, other: u32)
<<= operation. Read moreSource§impl ShlAssign<u64> for U512
impl ShlAssign<u64> for U512
Source§fn shl_assign(&mut self, other: u64)
fn shl_assign(&mut self, other: u64)
<<= operation. Read moreSource§impl ShlAssign<u8> for U512
impl ShlAssign<u8> for U512
Source§fn shl_assign(&mut self, other: u8)
fn shl_assign(&mut self, other: u8)
<<= operation. Read moreSource§impl ShlAssign<usize> for U512
impl ShlAssign<usize> for U512
Source§fn shl_assign(&mut self, other: usize)
fn shl_assign(&mut self, other: usize)
<<= operation. Read moreSource§impl ShrAssign<&I512> for U512
impl ShrAssign<&I512> for U512
Source§fn shr_assign(&mut self, other: &I512)
fn shr_assign(&mut self, other: &I512)
>>= operation. Read moreSource§impl ShrAssign<&U512> for I512
impl ShrAssign<&U512> for I512
Source§fn shr_assign(&mut self, other: &U512)
fn shr_assign(&mut self, other: &U512)
>>= operation. Read moreSource§impl ShrAssign<&i128> for U512
impl ShrAssign<&i128> for U512
Source§fn shr_assign(&mut self, other: &i128)
fn shr_assign(&mut self, other: &i128)
>>= operation. Read moreSource§impl ShrAssign<&i16> for U512
impl ShrAssign<&i16> for U512
Source§fn shr_assign(&mut self, other: &i16)
fn shr_assign(&mut self, other: &i16)
>>= operation. Read moreSource§impl ShrAssign<&i32> for U512
impl ShrAssign<&i32> for U512
Source§fn shr_assign(&mut self, other: &i32)
fn shr_assign(&mut self, other: &i32)
>>= operation. Read moreSource§impl ShrAssign<&i64> for U512
impl ShrAssign<&i64> for U512
Source§fn shr_assign(&mut self, other: &i64)
fn shr_assign(&mut self, other: &i64)
>>= operation. Read moreSource§impl ShrAssign<&i8> for U512
impl ShrAssign<&i8> for U512
Source§fn shr_assign(&mut self, other: &i8)
fn shr_assign(&mut self, other: &i8)
>>= operation. Read moreSource§impl ShrAssign<&isize> for U512
impl ShrAssign<&isize> for U512
Source§fn shr_assign(&mut self, other: &isize)
fn shr_assign(&mut self, other: &isize)
>>= operation. Read moreSource§impl ShrAssign<&u128> for U512
impl ShrAssign<&u128> for U512
Source§fn shr_assign(&mut self, other: &u128)
fn shr_assign(&mut self, other: &u128)
>>= operation. Read moreSource§impl ShrAssign<&u16> for U512
impl ShrAssign<&u16> for U512
Source§fn shr_assign(&mut self, other: &u16)
fn shr_assign(&mut self, other: &u16)
>>= operation. Read moreSource§impl ShrAssign<&u32> for U512
impl ShrAssign<&u32> for U512
Source§fn shr_assign(&mut self, other: &u32)
fn shr_assign(&mut self, other: &u32)
>>= operation. Read moreSource§impl ShrAssign<&u64> for U512
impl ShrAssign<&u64> for U512
Source§fn shr_assign(&mut self, other: &u64)
fn shr_assign(&mut self, other: &u64)
>>= operation. Read moreSource§impl ShrAssign<&u8> for U512
impl ShrAssign<&u8> for U512
Source§fn shr_assign(&mut self, other: &u8)
fn shr_assign(&mut self, other: &u8)
>>= operation. Read moreSource§impl ShrAssign<&usize> for U512
impl ShrAssign<&usize> for U512
Source§fn shr_assign(&mut self, other: &usize)
fn shr_assign(&mut self, other: &usize)
>>= operation. Read moreSource§impl ShrAssign<I512> for U512
impl ShrAssign<I512> for U512
Source§fn shr_assign(&mut self, other: I512)
fn shr_assign(&mut self, other: I512)
>>= operation. Read moreSource§impl ShrAssign<U512> for I512
impl ShrAssign<U512> for I512
Source§fn shr_assign(&mut self, other: U512)
fn shr_assign(&mut self, other: U512)
>>= operation. Read moreSource§impl ShrAssign<i128> for U512
impl ShrAssign<i128> for U512
Source§fn shr_assign(&mut self, other: i128)
fn shr_assign(&mut self, other: i128)
>>= operation. Read moreSource§impl ShrAssign<i16> for U512
impl ShrAssign<i16> for U512
Source§fn shr_assign(&mut self, other: i16)
fn shr_assign(&mut self, other: i16)
>>= operation. Read moreSource§impl ShrAssign<i32> for U512
impl ShrAssign<i32> for U512
Source§fn shr_assign(&mut self, other: i32)
fn shr_assign(&mut self, other: i32)
>>= operation. Read moreSource§impl ShrAssign<i64> for U512
impl ShrAssign<i64> for U512
Source§fn shr_assign(&mut self, other: i64)
fn shr_assign(&mut self, other: i64)
>>= operation. Read moreSource§impl ShrAssign<i8> for U512
impl ShrAssign<i8> for U512
Source§fn shr_assign(&mut self, other: i8)
fn shr_assign(&mut self, other: i8)
>>= operation. Read moreSource§impl ShrAssign<isize> for U512
impl ShrAssign<isize> for U512
Source§fn shr_assign(&mut self, other: isize)
fn shr_assign(&mut self, other: isize)
>>= operation. Read moreSource§impl ShrAssign<u128> for U512
impl ShrAssign<u128> for U512
Source§fn shr_assign(&mut self, other: u128)
fn shr_assign(&mut self, other: u128)
>>= operation. Read moreSource§impl ShrAssign<u16> for U512
impl ShrAssign<u16> for U512
Source§fn shr_assign(&mut self, other: u16)
fn shr_assign(&mut self, other: u16)
>>= operation. Read moreSource§impl ShrAssign<u32> for U512
impl ShrAssign<u32> for U512
Source§fn shr_assign(&mut self, other: u32)
fn shr_assign(&mut self, other: u32)
>>= operation. Read moreSource§impl ShrAssign<u64> for U512
impl ShrAssign<u64> for U512
Source§fn shr_assign(&mut self, other: u64)
fn shr_assign(&mut self, other: u64)
>>= operation. Read moreSource§impl ShrAssign<u8> for U512
impl ShrAssign<u8> for U512
Source§fn shr_assign(&mut self, other: u8)
fn shr_assign(&mut self, other: u8)
>>= operation. Read moreSource§impl ShrAssign<usize> for U512
impl ShrAssign<usize> for U512
Source§fn shr_assign(&mut self, other: usize)
fn shr_assign(&mut self, other: usize)
>>= operation. Read moreSource§impl SubAssign<&U512> for U512
impl SubAssign<&U512> for U512
Source§fn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
-= operation. Read moreSource§impl SubAssign for U512
impl SubAssign for U512
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-= operation. Read more