Skip to main content

BitExtraction

Trait BitExtraction 

Source
pub trait BitExtraction {
    // Required methods
    fn extract_bit(self, position: u32) -> u64;
    fn extract_bit_range(self, range: Range<u32>) -> u64;
    fn low_bits(self, num_bits: u32) -> u64;
    fn low_bits_signed(self, num_bits: u32) -> u64;
    fn sign_extend(self, sign_bit: u32) -> u64;
}

Required Methods§

Source

fn extract_bit(self, position: u32) -> u64

Extract a single bit from the provided value.

Source

fn extract_bit_range(self, range: Range<u32>) -> u64

Extract range bits from the provided value.

Source

fn low_bits(self, num_bits: u32) -> u64

Extract the low num_bits bits from self.

Source

fn low_bits_signed(self, num_bits: u32) -> u64

Extract the low num_bits bits from self, sign extending from the most significant bit.

Source

fn sign_extend(self, sign_bit: u32) -> u64

Sign-extend self from the given sign bit.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BitExtraction for u64

Source§

fn extract_bit(self, position: u32) -> u64

Source§

fn extract_bit_range(self, range: Range<u32>) -> u64

Source§

fn low_bits(self, num_bits: u32) -> u64

Source§

fn low_bits_signed(self, num_bits: u32) -> u64

Source§

fn sign_extend(self, sign_bit: u32) -> u64

Implementors§