docs

您正在閱讀 v0.1.0 的文件。Nabi 0.1.0 已停止支援。 最新版本:v0.1.3 →

core::num::impl u64

本頁內容

API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。

impl u64

  • pub const MIN: u64 = 0§

    Source

    The smallest value.

  • pub const MAX: u64 = 18446744073709551615§

    Source

    The largest value.

  • pub const BITS: u32 = 64§

    Source

    The width in bits.

  • pub const fn wrapping_add(self, rhs: u64) -> u64§

    Source

    self + rhs, wrapping around at the bounds.

  • pub const fn wrapping_sub(self, rhs: u64) -> u64§

    Source

    self - rhs, wrapping around at the bounds.

  • pub const fn wrapping_mul(self, rhs: u64) -> u64§

    Source

    self * rhs, wrapping around at the bounds.

  • pub const fn count_ones(self) -> u32§

    Source

    The number of one bits.

  • pub const fn count_zeros(self) -> u32§

    Source

    The number of zero bits.

  • pub const fn leading_zeros(self) -> u32§

    Source

    The number of zero bits above the highest one bit.

  • pub const fn trailing_zeros(self) -> u32§

    Source

    The number of zero bits below the lowest one bit.

  • pub const fn leading_ones(self) -> u32§

    Source

    The number of one bits above the highest zero bit.

  • pub const fn trailing_ones(self) -> u32§

    Source

    The number of one bits below the lowest zero bit.

  • pub const fn rotate_left(self, n: u32) -> u64§

    Source

    The bits shifted left by n, those shifted out coming back on the right.

  • pub const fn rotate_right(self, n: u32) -> u64§

    Source

    The bits shifted right by n, those shifted out coming back on the left.

  • pub const fn swap_bytes(self) -> u64§

    Source

    The bytes in reverse order.

  • pub const fn to_be(self) -> u64§

    Source

    self in big-endian byte order (unchanged on a big-endian target).

  • pub const fn to_le(self) -> u64§

    Source

    self in little-endian byte order (unchanged on a little-endian target).

  • pub const fn from_be(x: u64) -> u64§

    Source

    The number whose big-endian bytes are x.

  • pub const fn from_le(x: u64) -> u64§

    Source

    The number whose little-endian bytes are x.

  • pub const fn to_le_bytes(self) -> [u8; 8]§

    Source

    The bytes, least significant first.

  • pub const fn to_be_bytes(self) -> [u8; 8]§

    Source

    The bytes, most significant first.

  • pub const fn to_ne_bytes(self) -> [u8; 8]§

    Source

    The bytes in the target's byte order.

  • pub const fn from_le_bytes(bytes: [u8; 8]) -> u64§

    Source

    The number of bytes, least significant first.

  • pub const fn from_be_bytes(bytes: [u8; 8]) -> u64§

    Source

    The number of bytes, most significant first.

  • pub const fn from_ne_bytes(bytes: [u8; 8]) -> u64§

    Source

    The number of bytes, in the target's byte order.

  • pub const fn checked_add(self, rhs: u64) -> u64 | none§

    Source

    self + rhs, or none on overflow.

  • pub const fn checked_sub(self, rhs: u64) -> u64 | none§

    Source

    self - rhs, or none on overflow.

  • pub const fn checked_mul(self, rhs: u64) -> u64 | none§

    Source

    self * rhs, or none on overflow.

  • pub const fn checked_div(self, rhs: u64) -> u64 | none§

    Source

    self / rhs, or none when rhs is 0.

  • pub const fn checked_rem(self, rhs: u64) -> u64 | none§

    Source

    self % rhs, or none when rhs is 0.

  • pub const fn checked_neg(self) -> u64 | none§

    Source

    -self: 0 for 0, none for any other value.

  • pub const fn checked_shl(self, n: u32) -> u64 | none§

    Source

    self << n, or none when n is at least BITS.

  • pub const fn checked_shr(self, n: u32) -> u64 | none§

    Source

    self >> n, or none when n is at least BITS.

  • pub const fn checked_pow(self, exp: u32) -> u64 | none§

    Source

    self to the exp, or none on overflow.

  • pub const fn wrapping_div(self, rhs: u64) -> u64§

    Source

    self / rhs (it never overflows). Panics when rhs is 0.

  • pub const fn wrapping_rem(self, rhs: u64) -> u64§

    Source

    self % rhs (it never overflows). Panics when rhs is 0.

  • pub const fn wrapping_neg(self) -> u64§

    Source

    0 - self, wrapping around.

  • pub const fn wrapping_shl(self, n: u32) -> u64§

    Source

    self << (n % BITS).

  • pub const fn wrapping_shr(self, n: u32) -> u64§

    Source

    self >> (n % BITS).

  • pub const fn wrapping_pow(self, exp: u32) -> u64§

    Source

    self to the exp, wrapping around at the bounds.

  • pub const fn saturating_add(self, rhs: u64) -> u64§

    Source

    self + rhs, clamped to MIN..=MAX.

  • pub const fn saturating_sub(self, rhs: u64) -> u64§

    Source

    self - rhs, clamped to MIN..=MAX.

  • pub const fn saturating_mul(self, rhs: u64) -> u64§

    Source

    self * rhs, clamped to MIN..=MAX.

  • pub const fn saturating_pow(self, exp: u32) -> u64§

    Source

    self to the exp, clamped to MIN..=MAX.

  • pub const fn overflowing_add(self, rhs: u64) -> (u64, bool)§

    Source

    self + rhs wrapped, and whether it overflowed.

  • pub const fn overflowing_sub(self, rhs: u64) -> (u64, bool)§

    Source

    self - rhs wrapped, and whether it overflowed.

  • pub const fn overflowing_mul(self, rhs: u64) -> (u64, bool)§

    Source

    self * rhs wrapped, and whether it overflowed.

  • pub const fn overflowing_div(self, rhs: u64) -> (u64, bool)§

    Source

    self / rhs and false (it never overflows). Panics when rhs is 0.

  • pub const fn overflowing_rem(self, rhs: u64) -> (u64, bool)§

    Source

    self % rhs and false (it never overflows). Panics when rhs is 0.

  • pub const fn overflowing_neg(self) -> (u64, bool)§

    Source

    0 - self wrapped, and whether it overflowed (any value but 0).

  • pub const fn overflowing_shl(self, n: u32) -> (u64, bool)§

    Source

    self << (n % BITS), and whether n was at least BITS.

  • pub const fn overflowing_shr(self, n: u32) -> (u64, bool)§

    Source

    self >> (n % BITS), and whether n was at least BITS.

  • pub const fn overflowing_pow(self, exp: u32) -> (u64, bool)§

    Source

    self to the exp wrapped, and whether it overflowed.

  • pub const fn pow(self, exp: u32) -> u64§

    Source

    self to the exp; overflow is the arithmetic's (a panic; a wrap with overflow checks off).

  • pub const fn abs_diff(self, rhs: u64) -> u64§

    Source

    |self - rhs|, as the unsigned type of the same width; never overflows.

  • pub const fn div_floor(self, rhs: u64) -> u64§

    Source

    Quotient rounded toward negative infinity: / for an unsigned type (Python's //).

  • pub const fn rem_floor(self, rhs: u64) -> u64§

    Source

    The remainder with the divisor's sign: % for an unsigned type (Python's %).

  • pub const fn div_euclid(self, rhs: u64) -> u64§

    Source

    self / rhs (the same as / for unsigned numbers). Panics when rhs is 0.

  • pub const fn rem_euclid(self, rhs: u64) -> u64§

    Source

    self % rhs (the same as % for unsigned numbers). Panics when rhs is 0.

  • pub const fn isqrt(self) -> u64§

    Source

    Integer square root (rounded down).

  • pub const fn is_power_of_two(self) -> bool§

    Source

    true when exactly one bit is set.

  • pub const fn next_power_of_two(self) -> u64§

    Source

    The smallest power of two >= self; panics past MAX.

  • pub const fn checked_next_power_of_two(self) -> u64 | none§

    Source

    The smallest power of two >= self, or none past MAX.

  • pub const fn ilog2(self) -> u32§

    Source

    floor(log2(self)); panics unless self > 0.

  • pub const fn ilog10(self) -> u32§

    Source

    floor(log10(self)); panics unless self > 0.

  • pub const fn ilog(self, base: u64) -> u32§

    Source

    floor(log(self, base)); panics unless self > 0 and base >= 2.

  • pub const fn checked_ilog2(self) -> u32 | none§

    Source

    floor(log2(self)), or none unless self > 0.

  • pub const fn checked_ilog10(self) -> u32 | none§

    Source

    floor(log10(self)), or none unless self > 0.

  • pub const fn checked_ilog(self, base: u64) -> u32 | none§

    Source

    floor(log(self, base)), or none unless self > 0 and base >= 2.