Mojo function
log2_ceil
log2_ceil(val: Int) -> Int
Returns the ceiling of the base-2 logarithm of an integer value.
Args:
- val (
Int
): The input value.
Returns:
Int
: The ceiling of the base-2 logarithm of the input value, which corresponds
to the smallest power of 2 greater than or equal to the input. Returns 0
if val is 0.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!