Function highest_bit_set

Source
pub fn highest_bit_set(n: u32) -> u32
Expand description

bithacks functions. Implmented according to paper “Faster Remainder by Direct Computation Applications to Compilers and Software Libraries” Given a 32-bit number, find the highest bit number which is set 1. e.g:

  for 0011(3), returns 1.
  for 0100(4), returns 2.