i256

Struct I512

Source
pub struct I512 { /* private fields */ }
Expand description

The 512-bit signed 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 I512

Source

pub const MIN: Self

The smallest value that can be represented by this integer type.

See i128::MIN.

Source

pub const MAX: Self

The largest value that can be represented by this integer type (2256 - 1).

See i128::MAX.

Source

pub const BITS: u32 = 512u32

The size of this integer type in bits.

§Examples
assert_eq!(u256::BITS, 256);

See i128::BITS.

Source

pub const IS_SIGNED: bool = true

If the integer is signed, that is, can contain negative numbers.

Source

pub const fn min_value() -> Self

👎Deprecated

New code should prefer to use i128::MIN instead.

Returns the smallest value that can be represented by this integer type.

See i128::min_value.

Source

pub const fn max_value() -> Self

👎Deprecated

New code should prefer to use i128::MAX instead.

Returns the largest value that can be represented by this integer type.

See i128::max_value.

Source

pub const fn count_ones(self) -> u32

Returns the number of ones in the binary representation of self.

See i128::count_ones.

Source

pub const fn count_zeros(self) -> u32

Returns the number of zeros in the binary representation of self.

See i128::count_zeros.

Source

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 i128::leading_zeros.

Source

pub const fn trailing_zeros(self) -> u32

Returns the number of trailing zeros in the binary representation of self.

See i128::trailing_zeros.

Source

pub const fn leading_ones(self) -> u32

Returns the number of leading ones in the binary representation of self.

See i128::leading_ones.

Source

pub const fn trailing_ones(self) -> u32

Returns the number of trailing ones in the binary representation of self.

See i128::trailing_ones.

Source

pub const fn bitand_const(self, rhs: Self) -> Self

Const implementation of BitAnd.

Source

pub const fn bitor_const(self, rhs: Self) -> Self

Const implementation of BitOr.

Source

pub const fn bitxor_const(self, rhs: Self) -> Self

Const implementation of BitXor.

Source

pub const fn not_const(self) -> Self

Const implementation of Not.

Source

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 i128::rotate_left.

Source

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 i128::rotate_right.

Source

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 i128::wrapping_shl.

Source

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 i128::wrapping_shr.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn to_ne_u32(self) -> [u32; 16]

Returns the memory representation of this as a series of u32.

As the target platform’s native endianness is used, portable code should use to_be_u32 or to_le_u32, as appropriate, instead.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn to_ne_u64(self) -> [u64; 8]

Returns the memory representation of this as a series of u64.

As the target platform’s native endianness is used, portable code should use to_be_u64 or to_le_u64, as appropriate, instead.

Source

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.

Source

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.

Source

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.

Source

pub const fn eq_branched(self, rhs: Self) -> bool

Short-circuiting const implementation of Eq.

Source

pub const fn eq_const(self, rhs: Self) -> bool

Non-short circuiting const implementation of Eq.

Source

pub const fn lt_const(self, rhs: Self) -> bool

Non-short circuiting const implementation of PartialOrd::lt.

Source

pub const fn le_const(self, rhs: Self) -> bool

Non-short circuiting const implementation of PartialOrd::le.

Source

pub const fn gt_const(self, rhs: Self) -> bool

Non-short circuiting const implementation of PartialOrd::gt.

Source

pub const fn ge_const(self, rhs: Self) -> bool

Non-short circuiting const implementation of PartialOrd::ge.

Source

pub const fn cmp_const(self, rhs: Self) -> Ordering

Non-short circuiting const implementation of PartialOrd::cmp.

Source

pub const fn from_u8(value: u8) -> Self

Create the 512-bit signed integer from a u8, as if by an as cast.

Source

pub const fn from_u16(value: u16) -> Self

Create the 512-bit signed integer from a u16, as if by an as cast.

Source

pub const fn from_u32(value: u32) -> Self

Create the 512-bit signed integer from a u32, as if by an as cast.

Source

pub const fn from_u64(value: u64) -> Self

Create the 512-bit signed integer from a u64, as if by an as cast.

Source

pub const fn from_u128(value: u128) -> Self

Create the 512-bit signed integer from a u128, as if by an as cast.

Source

pub const fn from_ulimb(value: ULimb) -> Self

Create the 512-bit signed integer from an unsigned limb, as if by an as cast.

Source

pub const fn from_uwide(value: UWide) -> Self

Create the 512-bit signed integer from an unsigned wide type, as if by an as cast.

Source

pub const fn from_unsigned(value: U512) -> Self

Create the 512-bit signed integer from an unsigned integer, as if by an as cast.

Source

pub const fn from_signed(value: Self) -> Self

Create the 512-bit signed integer from a signed integer, as if by an as cast.

Source

pub const fn from_i8(value: i8) -> Self

Create the 512-bit signed integer from an i8, as if by an as cast.

Source

pub const fn from_i16(value: i16) -> Self

Create the 512-bit signed integer from an i16, as if by an as cast.

Source

pub const fn from_i32(value: i32) -> Self

Create the 512-bit signed integer from an i32, as if by an as cast.

Source

pub const fn from_i64(value: i64) -> Self

Create the 512-bit signed integer from an i64, as if by an as cast.

Source

pub const fn from_i128(value: i128) -> Self

Create the 256-bit unsigned integer from an i128, as if by an as cast.

Source

pub const fn from_ilimb(value: ILimb) -> Self

Create the 512-bit signed integer from a signed limb, as if by an as cast.

Source

pub const fn from_iwide(value: IWide) -> Self

Create the 512-bit signed integer from a wide type, as if by an as cast.

Source

pub const fn as_u8(&self) -> u8

Convert the 512-bit signed to a u8, as if by an as cast.

Source

pub const fn as_u16(&self) -> u16

Convert the 512-bit signed to a u16, as if by an as cast.

Source

pub const fn as_u32(&self) -> u32

Convert the 512-bit signed to a u32, as if by an as cast.

Source

pub const fn as_u64(&self) -> u64

Convert the 512-bit signed to a u64, as if by an as cast.

Source

pub const fn as_ulimb(&self) -> ULimb

Convert the 512-bit signed an unsigned limb, as if by an as cast.

Source

pub const fn as_u128(&self) -> u128

Convert the 512-bit signed to a u128, as if by an as cast.

Source

pub const fn as_uwide(&self) -> UWide

Convert the 512-bit signed an unsigned wide type, as if by an as cast.

Source

pub const fn as_i8(&self) -> i8

Convert the 512-bit signed to an i8, as if by an as cast.

Source

pub const fn as_i16(&self) -> i16

Convert the 512-bit signed to an i16, as if by an as cast.

Source

pub const fn as_i32(&self) -> i32

Convert the 512-bit signed to an i32, as if by an as cast.

Source

pub const fn as_i64(&self) -> i64

Convert the 512-bit signed to an i64, as if by an as cast.

Source

pub const fn as_i128(&self) -> i128

Convert the 512-bit signed to a i128, as if by an as cast.

Source

pub const fn as_ilimb(&self) -> ILimb

Convert the 512-bit signed a signed limb, as if by an as cast.

Source

pub const fn as_iwide(&self) -> IWide

Convert the 512-bit signed a signed wide type, as if by an as cast.

Source

pub const fn as_unsigned(&self) -> U512

Convert the 512-bit signed unsigned integer to the unsigned type, as if by an as cast.

Source

pub const fn as_signed(&self) -> Self

Convert the 512-bit signed unsigned integer to the signed type, as if by an as cast.

Source

pub const fn cast_unsigned(self) -> U512

Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.

This produces the same result as an as cast, but ensures that the bit-width remains the same.

See i128::cast_unsigned.

Source

pub const fn is_even(&self) -> bool

Get if the integer is even.

Source

pub const fn is_odd(&self) -> bool

Get if the integer is odd.

Source

pub const fn get_limb(&self, index: usize) -> ULimb

Get the limb indexing from the least-significant order.

Source

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.

Source

pub const fn least_significant_limb(&self) -> ULimb

Get the least significant limb in the buiffer.

Source

pub const fn most_significant_limb(&self) -> ILimb

Get the most significant limb in the buiffer.

Source

pub const fn is_positive(self) -> bool

Returns true if self is positive and false if the number is zero or negative.

See i128::is_positive.

Source

pub const fn is_negative(self) -> bool

Returns true if self is negative and false if the number is zero or positive.

See i128::is_negative.

Source

pub const fn pow(self, exp: u32) -> Self

Raises self to the power of exp, using exponentiation by squaring.

See i128::pow.

Source

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.

Source

pub const fn unsigned_abs(self) -> U512

Computes the absolute value of self without any wrapping or panicking.

See i128::unsigned_abs.

Source

pub fn div_euclid(self, rhs: Self) -> Self

Calculates the quotient of Euclidean division of self by rhs.

This computes the integer q such that self = q * rhs + r, with r = self.rem_euclid(rhs) and 0 <= r < abs(rhs).

In other words, the result is self / rhs rounded to the integer q such that self >= q * rhs. If self > 0, this is equal to rounding towards zero (the default in Rust); if self < 0, this is equal to rounding away from zero (towards +/- infinity). If rhs > 0, this is equal to rounding towards -infinity; if rhs < 0, this is equal to rounding towards +infinity.

§Panics

This function will panic if rhs is zero or if self is Self::MIN and rhs is -1. This behavior is not affected by the overflow-checks flag.

See i128::div_euclid.

Source

pub fn rem_euclid(self, rhs: Self) -> Self

Calculates the least nonnegative remainder of self (mod rhs).

This is done as if by the Euclidean division algorithm – given r = self.rem_euclid(rhs), the result satisfies self = rhs * self.div_euclid(rhs) + r and 0 <= r < abs(rhs).

§Panics

This function will panic if rhs is zero or if self is Self::MIN and rhs is -1. This behavior is not affected by the overflow-checks flag.

See i128::rem_euclid.

Source

pub fn div_floor(self, rhs: Self) -> Self

Calculates the quotient of self and rhs, rounding the result towards negative infinity.

§Panics

This function will panic if rhs is zero or if self is Self::MIN and rhs is -1. This behavior is not affected by the overflow-checks flag.

See i128::div_floor.

Source

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 or if self is Self::MIN and rhs is -1. This behavior is not affected by the overflow-checks flag.

See i128::div_ceil.

Source

pub fn next_multiple_of(self, rhs: Self) -> Self

If rhs is positive, calculates the smallest value greater than or equal to self that is a multiple of rhs. If rhs is negative, calculates the largest value less 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).

See i128::next_multiple_of.

Source

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 less than or equal to zero, or if base is less than 2.

See i128::ilog.

Source

pub const fn ilog2(self) -> u32

Returns the base 2 logarithm of the number, rounded down.

§Panics

This function will panic if self is less than or equal to zero.

See i128::ilog2.

Source

pub const fn abs(self) -> Self

Computes the absolute value of self.

See i128::abs.

Source

pub const fn abs_diff(self, other: Self) -> U512

Computes the absolute difference between self and other.

This function always returns the correct answer without overflow or panics by returning an unsigned integer.

See i128::abs_diff.

Source

pub const fn signum(self) -> Self

Returns a number representing sign of self.

  • 0 if the number is zero
  • 1 if the number is positive
  • -1 if the number is negative

See i128::signum.

Source

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 negative infinity and that no overflow will ever occur.

See i128::midpoint.

Source

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 i128::carrying_add.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool)

Calculates selfrhsborrow 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 i128::borrowing_sub.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::wrapping_pow.

Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping (modular) addition. Computes self + rhs, wrapping around at the boundary of the type.

See i128::wrapping_add.

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping (modular) subtraction. Computes self - rhs, wrapping around at the boundary of the type.

See i128::wrapping_sub.

Source

pub const fn wrapping_sub_unsigned(self, rhs: U512) -> Self

Wrapping (modular) subtraction with an unsigned integer. Computes self - rhs, wrapping around at the boundary of the type.

See i128::wrapping_sub_unsigned.

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary of the type.

This in worst case 10 mul and 13 add instructions, because of branching in nearly every case, it has better performance and optimizes nicely for small multiplications. See u256::wrapping_mul for a more detailed analysis, which is identical.

See i128::wrapping_mul.

Source

pub fn wrapping_div_rem(self, n: Self) -> (Self, Self)

Div/Rem operation on the integer.

This allows storing of both the quotient and remainder without making repeated calls.

§Panics

This panics if the divisor is 0.

Source

pub fn wrapping_div(self, rhs: Self) -> Self

Wrapping (modular) division. Computes self / rhs, wrapping around at the boundary of the type.

The only case where such wrapping can occur is when one divides MIN / -1 on a signed type (where MIN is the negative minimal value for the type); this is equivalent to -MIN, a positive value that is too large to represent in the type. In such a case, this function returns MIN itself.

§Panics

This function will panic if rhs is zero.

See i128::wrapping_div.

Source

pub fn wrapping_div_euclid(self, rhs: Self) -> Self

Wrapping Euclidean division. Computes self.div_euclid(rhs), wrapping around at the boundary of the type.

Wrapping will only occur in MIN / -1 on a signed type (where MIN is the negative minimal value for the type). This is equivalent to -MIN, a positive value that is too large to represent in the type. In this case, this method returns MIN itself.

§Panics

This function will panic if rhs is zero.

See i128::wrapping_div_euclid.

Source

pub fn wrapping_rem(self, rhs: Self) -> Self

Wrapping (modular) remainder. Computes self % rhs, wrapping around at the boundary of the type.

Such wrap-around never actually occurs mathematically; implementation artifacts make x % y invalid for MIN / -1 on a signed type (where MIN is the negative minimal value). In such a case, this function returns 0.

§Panics

This function will panic if rhs is zero.

See i128::wrapping_rem.

Source

pub fn wrapping_rem_euclid(self, rhs: Self) -> Self

Wrapping Euclidean remainder. Computes self.rem_euclid(rhs), wrapping around at the boundary of the type.

Wrapping will only occur in MIN % -1 on a signed type (where MIN is the negative minimal value for the type). In this case, this method returns 0.

See i128::wrapping_rem_euclid.

Source

pub const fn wrapping_neg(self) -> Self

Wrapping (modular) negation. Computes -self, wrapping around at the boundary of the type.

The only case where such wrapping can occur is when one negates MIN on a signed type (where MIN is the negative minimal value for the type); this is a positive value that is too large to represent in the type. In such a case, this function returns MIN itself.

See i128::wrapping_neg.

Source

pub const fn wrapping_abs(self) -> Self

Wrapping (modular) absolute value. Computes self.abs(), wrapping around at the boundary of the type.

The only case where such wrapping can occur is when one takes the absolute value of the negative minimal value for the type; this is a positive value that is too large to represent in the type. In such a case, this function returns MIN itself.

See i128::wrapping_abs.

Source

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.

See i128::overflowing_pow.

Source

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.

Source

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.

See i128::overflowing_add.

Source

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.

See i128::overflowing_sub.

Source

pub const fn overflowing_add_unsigned(self, rhs: U512) -> (Self, bool)

Calculates self + rhs with an unsigned 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.

See i128::overflowing_add_unsigned.

Source

pub const fn overflowing_sub_unsigned(self, rhs: U512) -> (Self, bool)

Calculates self - rhs with an unsigned 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.

See i128::overflowing_sub_unsigned.

Source

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.

This in worst case 10 mul, 20 add, and 9 sub instructions, significantly slower than the wrapping variant.

See i128::overflowing_mul.

Source

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. If an overflow would occur then self is returned.

§Panics

This function will panic if rhs is zero.

See i128::overflowing_div.

Source

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. If an overflow would occur then self is returned.

§Panics

This function will panic if rhs is zero.

See i128::overflowing_div_euclid.

Source

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. If an overflow would occur then 0 is returned.

§Panics

This function will panic if rhs is zero.

See i128::overflowing_rem.

Source

pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)

Overflowing Euclidean remainder. Calculates self.rem_euclid(rhs).

Returns a tuple of the remainder after dividing along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would occur then 0 is returned.

§Panics

This function will panic if rhs is zero.

See i128::overflowing_rem_euclid.

Source

pub const fn overflowing_neg(self) -> (Self, bool)

Negates self, overflowing if this is equal to the minimum value.

Returns a tuple of the negated version of self along with a boolean indicating whether an overflow happened. If self is the minimum value (e.g., i32::MIN for values of type i32), then the minimum value will be returned again and true will be returned for an overflow happening.

See i128::overflowing_neg.

Source

pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)

Shifts self left by rhs bits.

Returns a tuple of the shifted version of self along with a boolean indicating whether the shift value was larger than or equal to the number of bits. If the shift value is too large, then value is masked (N-1) where N is the number of bits, and this value is then used to perform the shift.

See i128::overflowing_shl.

Source

pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)

Shifts self right by rhs bits.

Returns a tuple of the shifted version of self along with a boolean indicating whether the shift value was larger than or equal to the number of bits. If the shift value is too large, then value is masked (N-1) where N is the number of bits, and this value is then used to perform the shift.

See i128::overflowing_shr.

Source

pub const fn overflowing_abs(self) -> (Self, bool)

Computes the absolute value of self.

Returns a tuple of the absolute version of self along with a boolean indicating whether an overflow happened.

See i128::overflowing_abs.

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.

See i128::saturating_add.

Source

pub const fn saturating_add_unsigned(self, rhs: U512) -> Self

Saturating addition with an unsigned integer. Computes self + rhs, saturating at the numeric bounds instead of overflowing.

See i128::saturating_add_unsigned.

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Saturating integer subtraction. Computes self - rhs, saturating at the numeric bounds instead of overflowing.

See i128::saturating_sub.

Source

pub const fn saturating_sub_unsigned(self, rhs: U512) -> Self

Saturating subtraction with an unsigned integer. Computes self - rhs, saturating at the numeric bounds instead of overflowing.

See i128::saturating_sub_unsigned.

Source

pub const fn saturating_neg(self) -> Self

Saturating integer negation. Computes -self, returning MAX if self == MIN instead of overflowing.

See i128::saturating_neg.

Source

pub const fn saturating_abs(self) -> Self

Saturating absolute value. Computes self.abs(), returning MAX if self == MIN instead of overflowing.

See i128::saturating_abs.

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Saturating integer multiplication. Computes self * rhs, saturating at the numeric bounds instead of overflowing.

See i128::saturating_mul.

Source

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 i128::saturating_div.

Source

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 i128::saturating_pow.

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Checked integer addition. Computes self + rhs, returning None if overflow occurred.

See i128::checked_add.

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.

See i128::checked_sub.

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Checked integer multiplication. Computes self * rhs, returning None if overflow occurred.

See i128::checked_mul.

Source

pub const fn checked_pow(self, base: u32) -> Option<Self>

Checked exponentiation. Computes self.pow(exp), returning None if overflow occurred.

See i128::checked_pow.

Source

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.

Source

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 i128::checked_div.

Source

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 i128::checked_rem.

Source

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).

See i128::checked_div_euclid.

Source

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).

See i128::checked_rem_euclid.

Source

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 i128::checked_shl.

Source

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 i128::checked_shr.

Source

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 i128::checked_ilog2.

Source

pub const fn checked_add_unsigned(self, rhs: U512) -> Option<Self>

Checked addition with an unsigned integer. Computes self + rhs, returning None if overflow occurred.

See i128::checked_add_unsigned.

Source

pub const fn checked_sub_unsigned(self, rhs: U512) -> Option<Self>

Checked subtraction with an unsigned integer. Computes self - rhs, returning None if overflow occurred.

See i128::checked_sub_unsigned.

Source

pub const fn checked_neg(self) -> Option<Self>

Checked negation. Computes -self, returning None if self == MIN.

See i128::checked_neg.

Source

pub const fn checked_abs(self) -> Option<Self>

Checked absolute value. Computes self.abs(), returning None if self == MIN.

See i128::checked_abs.

Source

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 negative or 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 i128::checked_ilog.

Source

pub fn checked_next_multiple_of(self, rhs: Self) -> Option<Self>

If rhs is positive, calculates the smallest value greater than or equal to self that is a multiple of rhs. If rhs is negative, calculates the largest value less 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 i128::checked_next_multiple_of.

Source

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 i128::strict_add.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::strict_sub.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::strict_mul.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::strict_pow.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::strict_shl.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::strict_shr.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub const fn strict_add_unsigned(self, rhs: U512) -> Self

Strict addition with an unsigned 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 i128::strict_add_unsigned.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub const fn strict_sub_unsigned(self, rhs: U512) -> Self

Strict subtraction with an unsigned 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 i128::strict_sub_unsigned.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub fn strict_div(self, rhs: Self) -> Self

Strict integer division. Computes self / rhs, panicking if overflow occurred.

§Panics

This function will panic if rhs is zero.

§Overflow behavior

This function will always panic on overflow, regardless of whether overflow checks are enabled.

The only case where such an overflow can occur is when one divides MIN / -1 on a signed type (where MIN is the negative minimal value for the type.

See i128::strict_div.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub fn strict_rem(self, rhs: Self) -> Self

Strict integer remainder. Computes self % rhs, panicking if the division results in overflow.

§Panics

This function will panic if rhs is zero.

§Overflow behavior

This function will always panic on overflow, regardless of whether overflow checks are enabled.

The only case where such an overflow can occur is x % y for MIN / -1 on a signed type (where MIN is the negative minimal value), which is invalid due to implementation artifacts.

See i128::strict_rem.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub fn strict_div_euclid(self, rhs: Self) -> Self

Strict Euclidean division. Computes self.div_euclid(rhs), panicking if overflow occurred.

§Panics

This function will panic if rhs is zero.

§Overflow behavior

This function will always panic on overflow, regardless of whether overflow checks are enabled.

The only case where such an overflow can occur is when one divides MIN / -1 on a signed type (where MIN is the negative minimal value for the type); this is equivalent to -MIN, a positive value that is too large to represent in the type.

See i128::strict_div_euclid.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub fn strict_rem_euclid(self, rhs: Self) -> Self

Strict Euclidean remainder. Computes self.rem_euclid(rhs), panicking if the division results in overflow.

§Panics

This function will panic if rhs is zero.

§Overflow behavior

This function will always panic on overflow, regardless of whether overflow checks are enabled.

The only case where such an overflow can occur is x % y for MIN / -1 on a signed type (where MIN is the negative minimal value), which is invalid due to implementation artifacts.

See i128::strict_rem_euclid.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub const fn strict_neg(self) -> Self

Strict negation. Computes -self, panicking if self == MIN.

§Panics
§Overflow behavior

This function will always panic on overflow, regardless of whether overflow checks are enabled.

See i128::strict_neg.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub const fn strict_abs(self) -> Self

Strict absolute value. Computes self.abs(), panicking if self == MIN.

§Panics
§Overflow behavior

This function will always panic on overflow, regardless of whether overflow checks are enabled.

See i128::strict_abs.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

pub unsafe fn unchecked_neg(self) -> Self

Unchecked negation. Computes -self, assuming overflow cannot occur.

§Safety

This results in undefined behavior when the value overflows.

See i128::unchecked_neg.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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 i128::unchecked_add.

Source

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 i128::unchecked_sub.

Source

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 i128::unchecked_mul.

Source

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 i128::unchecked_shl.

Source

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 i128::unchecked_shr.

Source

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.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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.

This is a nightly-only experimental API in the Rust core implementation, and therefore is subject to change at any time.
Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn add_ilimb(self, n: ILimb) -> Self

Add a signed limb to the big integer.

This allows optimizations a full addition cannot do.

Source

pub const fn sub_ilimb(self, n: ILimb) -> Self

Subtract a signed limb from the big integer.

This allows optimizations a full subtraction cannot do.

Source

pub const fn mul_ilimb(self, n: ILimb) -> Self

Multiply our big integer by a signed limb.

This allows optimizations a full multiplication cannot do.

Source

pub fn div_rem_ilimb(self, n: ILimb) -> (Self, ILimb)

Get the quotient and remainder of our big integer divided by a signed limb.

This allows optimizations a full division cannot do.

Source

pub fn div_ilimb(self, n: ILimb) -> Self

Get the quotient of our big integer divided by a signed limb.

This allows optimizations a full division cannot do.

Source

pub fn rem_ilimb(self, n: ILimb) -> ILimb

Get the remainder of our big integer divided by a signed limb.

This allows optimizations a full division cannot do.

Source

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.

Source

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.

Source

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.

Source

pub const fn wrapping_add_ilimb(self, n: ILimb) -> Self

Add a signed limb to the big integer, wrapping on overflow.

This allows optimizations a full addition cannot do.

Source

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.

Source

pub const fn wrapping_sub_ilimb(self, n: ILimb) -> Self

Subtract a signed limb from the big integer, wrapping on overflow.

This allows optimizations a full subtraction cannot do.

Source

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. This in worst case 5 mul, 3 add, and 6 sub instructions, because of branching in nearly every case, it has better performance and optimizes nicely for small multiplications. See u256::wrapping_mul_ulimb for a more detailed analysis, which is identical.

Source

pub const fn wrapping_mul_ilimb(self, n: ILimb) -> Self

Multiply our big integer by a signed limb, wrapping on overflow.

This allows optimizations a full multiplication cannot do. This in worst case 4 mul, 3 add, and 6 sub instructions, because of branching in nearly every case, it has better performance and optimizes nicely for small multiplications.

Source

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. This always wraps, which can never happen in practice. This has to use the floor division since we can never have a non-negative rem.

Source

pub fn wrapping_div_rem_ilimb(self, n: ILimb) -> (Self, ILimb)

Get the quotient and remainder of our big integer divided by a signed limb, wrapping on overflow.

This allows optimizations a full division cannot do. This always wraps, which can never happen in practice.

Source

pub fn wrapping_div_ilimb(self, n: ILimb) -> Self

Get the quotient of our big integer divided by a signed limb, wrapping on overflow.

This allows optimizations a full division cannot do.

Source

pub fn wrapping_rem_ilimb(self, n: ILimb) -> ILimb

Get the remainder of our big integer divided by a signed limb, wrapping on overflow.

This allows optimizations a full division cannot do.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn overflowing_add_ilimb(self, n: ILimb) -> (Self, bool)

Add a signed limb to the big integer, returning the value and if overflow occurred.

This allows optimizations a full addition cannot do.

Source

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.

Source

pub const fn overflowing_sub_ilimb(self, n: ILimb) -> (Self, bool)

Subtract a signed limb from the big integer, returning the value and if overflow occurred.

This allows optimizations a full subtraction cannot do.

Source

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.

This allows optimizations a full multiplication cannot do. This in worst case 4 mul, 4 add, and 6 sub instructions, significantly slower than the wrapping variant.

Source

pub const fn overflowing_mul_ilimb(self, n: ILimb) -> (Self, bool)

Multiply our big integer by a signed limb, returning the value and if overflow occurred.

This allows optimizations a full multiplication cannot do. This in worst case 5 mul, 5 add, and 6 sub instructions, significantly slower than the wrapping variant.

Source

pub fn overflowing_div_rem_ilimb(self, n: ILimb) -> ((Self, ILimb), bool)

Get the quotient and remainder of our big integer divided by a signed limb, returning the value and if overflow occurred.

This allows optimizations a full division cannot do.

Source

pub fn overflowing_div_ilimb(self, n: ILimb) -> (Self, bool)

Get the quotient of our big integer divided by a signed limb, returning the value and if overflow occurred.

This allows optimizations a full division cannot do.

Source

pub fn overflowing_rem_ilimb(self, n: ILimb) -> (ILimb, bool)

Get the remainder of our big integer divided by a signed limb, returning the value and if overflow occurred.

This allows optimizations a full division cannot do.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn checked_add_ilimb(self, n: ILimb) -> Option<Self>

Add a signed limb to the big integer, returning None on overflow.

This allows optimizations a full addition cannot do.

Source

pub const fn checked_sub_ilimb(self, n: ILimb) -> Option<Self>

Subtract a signed limb from the big integer, returning None on overflow.

This allows optimizations a full subtraction cannot do.

Source

pub const fn checked_mul_ilimb(self, n: ILimb) -> Option<Self>

Multiply our big integer by a signed limb, returning None on overflow.

This allows optimizations a full multiplication cannot do.

Source

pub fn checked_div_rem_ilimb(self, n: ILimb) -> Option<(Self, ILimb)>

Get the quotient and 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.

Source

pub fn checked_div_ilimb(self, n: ILimb) -> Option<Self>

Get the quotient 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.

Source

pub fn checked_rem_ilimb(self, n: ILimb) -> Option<ILimb>

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.

Source

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-9
  • a-z
  • A-Z

This only has rudimentary optimizations.

§Panics

This function panics if radix is not in the range from 2 to 36.

Source

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-9
  • a-z
  • A-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 Add<&I512> for I512

Source§

type Output = <I512 as Add>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for I512

Source§

type Output = I512

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<&I512> for I512

Source§

fn add_assign(&mut self, other: &Self)

Performs the += operation. Read more
Source§

impl AddAssign for I512

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl Binary for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl BitAnd<&I512> for I512

Source§

type Output = <I512 as BitAnd>::Output

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd for I512

Source§

type Output = I512

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAndAssign<&I512> for I512

Source§

fn bitand_assign(&mut self, other: &Self)

Performs the &= operation. Read more
Source§

impl BitAndAssign for I512

Source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
Source§

impl BitOr<&I512> for I512

Source§

type Output = <I512 as BitOr>::Output

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr for I512

Source§

type Output = I512

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOrAssign<&I512> for I512

Source§

fn bitor_assign(&mut self, other: &Self)

Performs the |= operation. Read more
Source§

impl BitOrAssign for I512

Source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
Source§

impl BitXor<&I512> for I512

Source§

type Output = <I512 as BitXor>::Output

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXor for I512

Source§

type Output = I512

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXorAssign<&I512> for I512

Source§

fn bitxor_assign(&mut self, other: &Self)

Performs the ^= operation. Read more
Source§

impl BitXorAssign for I512

Source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
Source§

impl Clone for I512

Source§

fn clone(&self) -> I512

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for I512

Source§

fn default() -> I512

Returns the “default value” for a type. Read more
Source§

impl Display for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Div<&I512> for I512

Source§

type Output = <I512 as Div>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Self) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for I512

Source§

type Output = I512

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<&I512> for I512

Source§

fn div_assign(&mut self, other: &Self)

Performs the /= operation. Read more
Source§

impl DivAssign for I512

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl From<bool> for I512

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<char> for I512

Source§

fn from(value: char) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for I512

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for I512

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for I512

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for I512

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for I512

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for I512

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for I512

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for I512

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for I512

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for I512

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl FromStr for I512

Source§

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 theimplementation.

Source§

type Err = ParseIntError

The associated error which can be returned from parsing.
Source§

impl Hash for I512

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LowerExp for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl LowerHex for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Mul<&I512> for I512

Source§

type Output = <I512 as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Self) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for I512

Source§

type Output = I512

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<&I512> for I512

Source§

fn mul_assign(&mut self, other: &Self)

Performs the *= operation. Read more
Source§

impl MulAssign for I512

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl Neg for &I512

Source§

type Output = <I512 as Neg>::Output

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Neg for I512

Source§

type Output = I512

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Not for &I512

Source§

type Output = <I512 as Not>::Output

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Not for I512

Source§

type Output = I512

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Octal for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Ord for I512

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for I512

Source§

fn eq(&self, other: &I512) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for I512

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Self) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Self) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &Self) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &Self) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<&I512> for I512

Source§

type Output = <I512 as Rem>::Output

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Self) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for I512

Source§

type Output = I512

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl RemAssign<&I512> for I512

Source§

fn rem_assign(&mut self, other: &Self)

Performs the %= operation. Read more
Source§

impl RemAssign for I512

Source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
Source§

impl Shl<&I512> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &Self) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&I512> for U512

Source§

type Output = <U512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &I512) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&U512> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &U512) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&i128> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &i128) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&i16> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &i16) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&i32> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &i32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&i64> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &i64) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&i8> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &i8) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&isize> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &isize) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&u128> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &u128) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&u16> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &u16) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&u32> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &u32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&u64> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &u64) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&u8> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &u8) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<&usize> for I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &usize) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<I512> for U512

Source§

type Output = U512

The resulting type after applying the << operator.
Source§

fn shl(self, other: I512) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<U512> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: U512) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<i128> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: i128) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<i16> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: i16) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<i32> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: i32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<i64> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: i64) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<i8> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: i8) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<isize> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: isize) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u128> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: u128) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u16> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: u16) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u32> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: u32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u64> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: u64) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u8> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: u8) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<usize> for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: usize) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl for &I512

Source§

type Output = <I512 as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl(self, other: &I512) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl for I512

Source§

type Output = I512

The resulting type after applying the << operator.
Source§

fn shl(self, other: Self) -> Self::Output

Performs the << operation. Read more
Source§

impl ShlAssign<&I512> for U512

Source§

fn shl_assign(&mut self, other: &I512)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&U512> for I512

Source§

fn shl_assign(&mut self, other: &U512)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&i128> for I512

Source§

fn shl_assign(&mut self, other: &i128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&i16> for I512

Source§

fn shl_assign(&mut self, other: &i16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&i32> for I512

Source§

fn shl_assign(&mut self, other: &i32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&i64> for I512

Source§

fn shl_assign(&mut self, other: &i64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&i8> for I512

Source§

fn shl_assign(&mut self, other: &i8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&isize> for I512

Source§

fn shl_assign(&mut self, other: &isize)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&u128> for I512

Source§

fn shl_assign(&mut self, other: &u128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&u16> for I512

Source§

fn shl_assign(&mut self, other: &u16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&u32> for I512

Source§

fn shl_assign(&mut self, other: &u32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&u64> for I512

Source§

fn shl_assign(&mut self, other: &u64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&u8> for I512

Source§

fn shl_assign(&mut self, other: &u8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<&usize> for I512

Source§

fn shl_assign(&mut self, other: &usize)

Performs the <<= operation. Read more
Source§

impl ShlAssign<I512> for U512

Source§

fn shl_assign(&mut self, other: I512)

Performs the <<= operation. Read more
Source§

impl ShlAssign<U512> for I512

Source§

fn shl_assign(&mut self, other: U512)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i128> for I512

Source§

fn shl_assign(&mut self, other: i128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i16> for I512

Source§

fn shl_assign(&mut self, other: i16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i32> for I512

Source§

fn shl_assign(&mut self, other: i32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i64> for I512

Source§

fn shl_assign(&mut self, other: i64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<i8> for I512

Source§

fn shl_assign(&mut self, other: i8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<isize> for I512

Source§

fn shl_assign(&mut self, other: isize)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u128> for I512

Source§

fn shl_assign(&mut self, other: u128)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u16> for I512

Source§

fn shl_assign(&mut self, other: u16)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u32> for I512

Source§

fn shl_assign(&mut self, other: u32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u64> for I512

Source§

fn shl_assign(&mut self, other: u64)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u8> for I512

Source§

fn shl_assign(&mut self, other: u8)

Performs the <<= operation. Read more
Source§

impl ShlAssign<usize> for I512

Source§

fn shl_assign(&mut self, other: usize)

Performs the <<= operation. Read more
Source§

impl Shr<&I512> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: &Self) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&I512> for U512

Source§

type Output = <U512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &I512) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&U512> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &U512) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&i128> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &i128) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&i16> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &i16) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&i32> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &i32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&i64> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &i64) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&i8> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &i8) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&isize> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &isize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&u128> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &u128) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&u16> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &u16) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&u32> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&u64> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &u64) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&u8> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &u8) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<&usize> for I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<I512> for U512

Source§

type Output = U512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: I512) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<U512> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: U512) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<i128> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: i128) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<i16> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: i16) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<i32> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: i32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<i64> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: i64) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<i8> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: i8) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<isize> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: isize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u128> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: u128) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u16> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: u16) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u32> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u64> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: u64) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u8> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: u8) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<usize> for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr for &I512

Source§

type Output = <I512 as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &I512) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr for I512

Source§

type Output = I512

The resulting type after applying the >> operator.
Source§

fn shr(self, other: Self) -> Self::Output

Performs the >> operation. Read more
Source§

impl ShrAssign<&I512> for U512

Source§

fn shr_assign(&mut self, other: &I512)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&U512> for I512

Source§

fn shr_assign(&mut self, other: &U512)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&i128> for I512

Source§

fn shr_assign(&mut self, other: &i128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&i16> for I512

Source§

fn shr_assign(&mut self, other: &i16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&i32> for I512

Source§

fn shr_assign(&mut self, other: &i32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&i64> for I512

Source§

fn shr_assign(&mut self, other: &i64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&i8> for I512

Source§

fn shr_assign(&mut self, other: &i8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&isize> for I512

Source§

fn shr_assign(&mut self, other: &isize)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&u128> for I512

Source§

fn shr_assign(&mut self, other: &u128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&u16> for I512

Source§

fn shr_assign(&mut self, other: &u16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&u32> for I512

Source§

fn shr_assign(&mut self, other: &u32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&u64> for I512

Source§

fn shr_assign(&mut self, other: &u64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&u8> for I512

Source§

fn shr_assign(&mut self, other: &u8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<&usize> for I512

Source§

fn shr_assign(&mut self, other: &usize)

Performs the >>= operation. Read more
Source§

impl ShrAssign<I512> for U512

Source§

fn shr_assign(&mut self, other: I512)

Performs the >>= operation. Read more
Source§

impl ShrAssign<U512> for I512

Source§

fn shr_assign(&mut self, other: U512)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i128> for I512

Source§

fn shr_assign(&mut self, other: i128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i16> for I512

Source§

fn shr_assign(&mut self, other: i16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i32> for I512

Source§

fn shr_assign(&mut self, other: i32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i64> for I512

Source§

fn shr_assign(&mut self, other: i64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<i8> for I512

Source§

fn shr_assign(&mut self, other: i8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<isize> for I512

Source§

fn shr_assign(&mut self, other: isize)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u128> for I512

Source§

fn shr_assign(&mut self, other: u128)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u16> for I512

Source§

fn shr_assign(&mut self, other: u16)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u32> for I512

Source§

fn shr_assign(&mut self, other: u32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u64> for I512

Source§

fn shr_assign(&mut self, other: u64)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u8> for I512

Source§

fn shr_assign(&mut self, other: u8)

Performs the >>= operation. Read more
Source§

impl ShrAssign<usize> for I512

Source§

fn shr_assign(&mut self, other: usize)

Performs the >>= operation. Read more
Source§

impl Sub<&I512> for I512

Source§

type Output = <I512 as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Self) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for I512

Source§

type Output = I512

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<&I512> for I512

Source§

fn sub_assign(&mut self, other: &Self)

Performs the -= operation. Read more
Source§

impl SubAssign for I512

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl TryFrom<I512> for U512

Source§

type Error = TryFromIntError

The type returned in the event of a conversion error.
Source§

fn try_from(u: I512) -> Result<Self, TryFromIntError>

Performs the conversion.
Source§

impl TryFrom<U512> for I512

Source§

type Error = TryFromIntError

The type returned in the event of a conversion error.
Source§

fn try_from(u: U512) -> Result<Self, TryFromIntError>

Performs the conversion.
Source§

impl UpperExp for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl UpperHex for I512

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Copy for I512

Source§

impl Eq for I512

Source§

impl StructuralPartialEq for I512

Auto Trait Implementations§

§

impl Freeze for I512

§

impl RefUnwindSafe for I512

§

impl Send for I512

§

impl Sync for I512

§

impl Unpin for I512

§

impl UnwindSafe for I512

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.