[−][src]Crate intbits
This crates provides two functions for accessing the individual bits of integers:
.bit(i)
to get one specific bit..bits(i..j)
to get a range of bits.
Example
use intbits::Bits; assert_eq!(2.bit(0), false); assert_eq!(2.bit(1), true); assert_eq!(2.bit(2), false); assert_eq!(0b1011u32.bits(0..2), 0b11); assert_eq!(0b1011u32.bits(2..4), 0b10);
Traits
Bits | Extension trait to provide access to individual bits of integers. |
BitsIndex | Trait for types that can be used to index the bits of |