Trait deepmesa_collections::bitvec::traits::AsMsb0[][src]

pub trait AsMsb0 {
    fn as_msb0(&self, n: usize) -> Self;
}
Expand description

Converts bits to an Msb0 ordering.

Given a specified number of bits, shift them left (towards the MSB) to produce an ordering such that those bits are counted from the MSB to the LSB

Examples

use deepmesa::collections::bitvec::AsMsb0;

let val: u8 = 0b0000_1100;
let converted = val.as_msb0(4);
assert_eq!(converted, 0b1100_0000);

If the bitcount equals the size of Self (in bits) then the value is unchanged.

Examples

use deepmesa::collections::bitvec::AsMsb0;

let val: u8 = 0b1010_1100;
let converted = val.as_msb0(8);
assert_eq!(converted, 0b1010_1100);

Required methods

Implementations on Foreign Types

Implementors