7 releases
Uses old Rust 2015
0.2.2 | Jul 31, 2015 |
---|---|
0.2.1 | Jul 31, 2015 |
0.1.1 | Jul 31, 2015 |
0.0.2 | Jul 9, 2015 |
#5 in #logarithm
29 downloads per month
Used in bitalloc
13KB
340 lines
#Integer Logarithm Library for Rust
##API List
- roundup_pow2(x), rounddown_pow2(x) for u8 ... u64, returns same integer type.
- bit_length<u8 ... u64>(), returns usize
- bit_mask<u8 ... u64>(), returns self-typed 0xFF...FF
- msb(x), lsb(x), msz(x), lsz(x) for u8 ... u64, returns i8, -1i8 on error. Index starts from 0.
- ffs(x), fls(x), ffz(x), flz(x) for u8 ... u64, returns u8, 0u8 means error. Index starts from 1.
- msb: Find first 1 bit from msb position. Return its index (index starts from lsb).
- lsb: Find first 1 bit from lsb position. Return its index (index starts from lsb).
- msz, lsz: Find 0 like above.
- ffs, fls, ffz, flz: +1 to lsb, msb, lsz, msz
Dependencies
~465KB