Function cuprate_helper::map::combine_low_high_bits_to_u128

source ยท
pub const fn combine_low_high_bits_to_u128(
    low_bits: u64,
    high_bits: u64,
) -> u128
Expand description

Combine 2 64-bit values into a single u128 value.

The inputs:

  • low_bits are the least significant 64-bits of cumulative_difficulty
  • high_bits are the most significant 64-bits of cumulative_difficulty

Note that low_bits & high_bits should be u64 representation of bits, not numerical values.

See split_u128_into_low_high_bits for the inverse function.

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

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