Integer Logarithm Library for Rust

API List

  1. rounduppow2(x), rounddownpow2(x) for u8 ... u64, returns same integer type.
  2. bit_length(), returns usize
  3. bit_mask(), returns self-typed 0xFF...FF
  4. msb(x), lsb(x), msz(x), lsz(x) for u8 ... u64, returns i8, -1i8 on error. Index starts from 0.
  5. ffs(x), fls(x), ffz(x), flz(x) for u8 ... u64, returns u8, 0u8 means error. Index starts from 1.