cuprate_helper::map

Function split_u128_into_low_high_bits

Source
pub const fn split_u128_into_low_high_bits(value: u128) -> (u64, u64)
Expand description

Split a u128 value into 2 64-bit values.

The tuple returned is (low, high) where low is the least significant 64-bits of number, and high is the most significant.

Note that the output of this function are u64 representations of bits, not numerical values.

See combine_low_high_bits_to_u128 for the inverse function.

let value = u128::MAX - 1;
let low = u64::MAX - 1;
let high = u64::MAX;

assert_eq!(split_u128_into_low_high_bits(value), (low, high));