Skip to main content

checked_log_size_sum

Function checked_log_size_sum 

Source
pub const fn checked_log_size_sum(a: usize, b: usize) -> Option<(usize, usize)>
Expand description

Adds two log-sizes and computes the resulting power of two.

Returns:

  • (a + b, 2^(a + b)) when the sum fits in a usize shift,
  • None if the addition overflows or the resulting power exceeds the representable range.