pub trait BitwiseClear {
type Output;
// Required methods
fn clear_lsb(self, n: u8) -> Self::Output;
fn clear_msb(self, n: u8) -> Self::Output;
fn clear_lsb_nth(self, n: u8) -> Self::Output;
fn clear_msb_nth(self, n: u8) -> Self::Output;
}
Expand description
Returns a value with some bits of self cleared.
Required Associated Types§
Required Methods§
Sourcefn clear_lsb(self, n: u8) -> Self::Output
fn clear_lsb(self, n: u8) -> Self::Output
Returns a value with the n
LSB bits of self
cleared.
§Examples
use deepmesa::collections::bitvec::BitwiseClear;
let val:u8 = 0b1011_1100;
assert_eq!(val.clear_lsb(4), 0b1011_0000);
Sourcefn clear_msb(self, n: u8) -> Self::Output
fn clear_msb(self, n: u8) -> Self::Output
Returns a value with the n
MSB bits of self
cleared.
§Examples
use deepmesa::collections::bitvec::BitwiseClear;
let val:u8 = 0b1011_1100;
assert_eq!(val.clear_msb(4), 0b0000_1100);
Sourcefn clear_lsb_nth(self, n: u8) -> Self::Output
fn clear_lsb_nth(self, n: u8) -> Self::Output
Returns a value with the nth
LSB bit of self
cleared.
§Examples
use deepmesa::collections::bitvec::BitwiseClear;
let val:u8 = 0b1011_1100;
assert_eq!(val.clear_lsb_nth(3), 0b1011_0100);
Sourcefn clear_msb_nth(self, n: u8) -> Self::Output
fn clear_msb_nth(self, n: u8) -> Self::Output
Returns a value with the nth
MSB bit of self
cleared.
§Examples
use deepmesa::collections::bitvec::BitwiseClear;
let val:u8 = 0b1011_1100;
assert_eq!(val.clear_msb_nth(3), 0b1010_1100);