deepmesa_collections::bitvec::traits

Trait BitwiseClear

Source
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§

Source

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);
Source

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);
Source

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);
Source

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);

Implementations on Foreign Types§

Source§

impl BitwiseClear for u8

Source§

type Output = u8

Source§

fn clear_lsb(self, n: u8) -> Self::Output

Source§

fn clear_msb(self, n: u8) -> Self::Output

Source§

fn clear_lsb_nth(self, n: u8) -> Self::Output

Source§

fn clear_msb_nth(self, n: u8) -> Self::Output

Implementors§