math.bits #
fn add_32 #
fn add_32(x u32, y u32, carry u32) (u32, u32)
--- Add with carry --- Add returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1.
add_32 returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
fn add_64 #
fn add_64(x u64, y u64, carry u64) (u64, u64)
add_64 returns the sum with carry of x, y and carry: sum = x + y + carry. The carry input must be 0 or 1; otherwise the behavior is undefined. The carryOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
fn div_32 #
fn div_32(hi u32, lo u32, y u32) (u32, u32)
--- Full-width divide --- div_32 returns the quotient and remainder of (hi, lo) divided by y: quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper half in parameter hi and the lower half in parameter lo. div_32 panics for y == 0 (division by zero) or y <= hi (quotient overflow).
fn div_64 #
fn div_64(hi u64, lo u64, y1 u64) (u64, u64)
div_64 returns the quotient and remainder of (hi, lo) divided by y: quo = (hi, lo)/y, rem = (hi, lo)%y with the dividend bits' upper half in parameter hi and the lower half in parameter lo. div_64 panics for y == 0 (division by zero) or y <= hi (quotient overflow).
fn f32_bits #
fn f32_bits(f f32) u32
f32_bits returns the IEEE 754 binary representation of f, with the sign bit of f and the result in the same bit position. f32_bits(f32_from_bits(x)) == x.
fn f32_from_bits #
fn f32_from_bits(b u32) f32
f32_from_bits returns the floating-point number corresponding to the IEEE 754 binary representation b, with the sign bit of b and the result in the same bit position. f32_from_bits(f32_bits(x)) == x.
fn f64_bits #
fn f64_bits(f f64) u64
f64_bits returns the IEEE 754 binary representation of f, with the sign bit of f and the result in the same bit position, and f64_bits(f64_from_bits(x)) == x.
fn f64_from_bits #
fn f64_from_bits(b u64) f64
f64_from_bits returns the floating-point number corresponding to the IEEE 754 binary representation b, with the sign bit of b and the result in the same bit position. f64_from_bits(f64_bits(x)) == x.
fn leading_zeros_16 #
fn leading_zeros_16(x u16) int
leading_zeros_16 returns the number of leading zero bits in x; the result is 16 for x == 0.
fn leading_zeros_32 #
fn leading_zeros_32(x u32) int
leading_zeros_32 returns the number of leading zero bits in x; the result is 32 for x == 0.
fn leading_zeros_64 #
fn leading_zeros_64(x u64) int
leading_zeros_64 returns the number of leading zero bits in x; the result is 64 for x == 0.
fn leading_zeros_8 #
fn leading_zeros_8(x u8) int
--- LeadingZeros --- leading_zeros_8 returns the number of leading zero bits in x; the result is 8 for x == 0.
fn len_16 #
fn len_16(x u16) int
len_16 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
fn len_32 #
fn len_32(x u32) int
len_32 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
fn len_64 #
fn len_64(x u64) int
len_64 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
fn len_8 #
fn len_8(x u8) int
--- Len --- len_8 returns the minimum number of bits required to represent x; the result is 0 for x == 0.
fn mul_32 #
fn mul_32(x u32, y u32) (u32, u32)
mul_32 returns the 64-bit product of x and y: (hi, lo) = x * y with the product bits' upper half returned in hi and the lower half returned in lo.
This function's execution time does not depend on the inputs.
fn mul_64 #
fn mul_64(x u64, y u64) (u64, u64)
mul_64 returns the 128-bit product of x and y: (hi, lo) = x * y with the product bits' upper half returned in hi and the lower half returned in lo.
This function's execution time does not depend on the inputs.
fn normalize #
fn normalize(x f64) (f64, int)
normalize returns a normal number y and exponent exp satisfying x == y × 2**exp. It assumes x is finite and non-zero.
fn ones_count_16 #
fn ones_count_16(x u16) int
ones_count_16 returns the number of one bits ("population count") in x.
fn ones_count_32 #
fn ones_count_32(x u32) int
ones_count_32 returns the number of one bits ("population count") in x.
fn ones_count_64 #
fn ones_count_64(x u64) int
ones_count_64 returns the number of one bits ("population count") in x.
fn ones_count_8 #
fn ones_count_8(x u8) int
--- OnesCount --- ones_count_8 returns the number of one bits ("population count") in x.
fn rem_32 #
fn rem_32(hi u32, lo u32, y u32) u32
rem_32 returns the remainder of (hi, lo) divided by y. Rem32 panics for y == 0 (division by zero) but, unlike Div32, it doesn't panic on a quotient overflow.
fn rem_64 #
fn rem_64(hi u64, lo u64, y u64) u64
rem_64 returns the remainder of (hi, lo) divided by y. Rem64 panics for y == 0 (division by zero) but, unlike div_64, it doesn't panic on a quotient overflow.
fn reverse_16 #
fn reverse_16(x u16) u16
reverse_16 returns the value of x with its bits in reversed order.
fn reverse_32 #
fn reverse_32(x u32) u32
reverse_32 returns the value of x with its bits in reversed order.
fn reverse_64 #
fn reverse_64(x u64) u64
reverse_64 returns the value of x with its bits in reversed order.
fn reverse_8 #
fn reverse_8(x u8) u8
--- Reverse --- reverse_8 returns the value of x with its bits in reversed order.
fn reverse_bytes_16 #
fn reverse_bytes_16(x u16) u16
--- ReverseBytes --- reverse_bytes_16 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
fn reverse_bytes_32 #
fn reverse_bytes_32(x u32) u32
reverse_bytes_32 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
fn reverse_bytes_64 #
fn reverse_bytes_64(x u64) u64
reverse_bytes_64 returns the value of x with its bytes in reversed order.
This function's execution time does not depend on the inputs.
fn rotate_left_16 #
fn rotate_left_16(x u16, k int) u16
rotate_left_16 returns the value of x rotated left by (k mod 16) bits. To rotate x right by k bits, call rotate_left_16(x, -k).
This function's execution time does not depend on the inputs.
fn rotate_left_32 #
fn rotate_left_32(x u32, k int) u32
rotate_left_32 returns the value of x rotated left by (k mod 32) bits. To rotate x right by k bits, call rotate_left_32(x, -k).
This function's execution time does not depend on the inputs.
fn rotate_left_64 #
fn rotate_left_64(x u64, k int) u64
rotate_left_64 returns the value of x rotated left by (k mod 64) bits. To rotate x right by k bits, call rotate_left_64(x, -k).
This function's execution time does not depend on the inputs.
fn rotate_left_8 #
fn rotate_left_8(x u8, k int) u8
--- RotateLeft --- rotate_left_8 returns the value of x rotated left by (k mod 8) bits. To rotate x right by k bits, call rotate_left_8(x, -k).
This function's execution time does not depend on the inputs.
fn sub_32 #
fn sub_32(x u32, y u32, borrow u32) (u32, u32)
--- Subtract with borrow --- Sub returns the difference of x, y and borrow: diff = x - y - borrow. The borrow input must be 0 or 1; otherwise the behavior is undefined. The borrowOut output is guaranteed to be 0 or 1.
sub_32 returns the difference of x, y and borrow, diff = x - y - borrow. The borrow input must be 0 or 1; otherwise the behavior is undefined. The borrowOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
fn sub_64 #
fn sub_64(x u64, y u64, borrow u64) (u64, u64)
sub_64 returns the difference of x, y and borrow: diff = x - y - borrow. The borrow input must be 0 or 1; otherwise the behavior is undefined. The borrowOut output is guaranteed to be 0 or 1.
This function's execution time does not depend on the inputs.
fn trailing_zeros_16 #
fn trailing_zeros_16(x u16) int
trailing_zeros_16 returns the number of trailing zero bits in x; the result is 16 for x == 0.
fn trailing_zeros_32 #
fn trailing_zeros_32(x u32) int
trailing_zeros_32 returns the number of trailing zero bits in x; the result is 32 for x == 0.
fn trailing_zeros_64 #
fn trailing_zeros_64(x u64) int
trailing_zeros_64 returns the number of trailing zero bits in x; the result is 64 for x == 0.
fn trailing_zeros_8 #
fn trailing_zeros_8(x u8) int
--- TrailingZeros --- trailing_zeros_8 returns the number of trailing zero bits in x; the result is 8 for x == 0.
- fn add_32
- fn add_64
- fn div_32
- fn div_64
- fn f32_bits
- fn f32_from_bits
- fn f64_bits
- fn f64_from_bits
- fn leading_zeros_16
- fn leading_zeros_32
- fn leading_zeros_64
- fn leading_zeros_8
- fn len_16
- fn len_32
- fn len_64
- fn len_8
- fn mul_32
- fn mul_64
- fn normalize
- fn ones_count_16
- fn ones_count_32
- fn ones_count_64
- fn ones_count_8
- fn rem_32
- fn rem_64
- fn reverse_16
- fn reverse_32
- fn reverse_64
- fn reverse_8
- fn reverse_bytes_16
- fn reverse_bytes_32
- fn reverse_bytes_64
- fn rotate_left_16
- fn rotate_left_32
- fn rotate_left_64
- fn rotate_left_8
- fn sub_32
- fn sub_64
- fn trailing_zeros_16
- fn trailing_zeros_32
- fn trailing_zeros_64
- fn trailing_zeros_8