pub fn log_2_ceil(val: u32) -> u32
Returns the number of bits needed to represent the given number
Inspired by https://graphics.stanford.edu/~seander/bithacks.html