Trait bitintr::Bextr
[−]
[src]
pub trait Bextr { fn bextr(self, start: Self, length: Self) -> Self; fn bextri(self, range: u32) -> Self; }
Bit field extract
Required Methods
fn bextr(self, start: Self, length: Self) -> Self
Bit field extract.
Extracts bits in range [start, start + length)
from the source
to
the least significant bits of the result.
Bits [7,0]
of range
specify the index to the first bit in the
range to be extracted, and bits [15,8]
specify the length of the
range.
Only bits up to size_of::<T>()*8 - 1
are extracted.
The extracted bits are written in the result starting from the least-significant bit. The high-order bits of the result are zeroed.
Instructions
BEXTR
:- Description: Bit field extract.
- Architecture: x86.
- Instruction set: BMI.
- Registers: 32/64 bit.
Example
assert_eq!(0b0101_0000u8.bextr(4, 4), 0b0000_0101u8);
fn bextri(self, range: u32) -> Self
Bit Field Extract (with immediate operand).
Extracts bits in range
from the source
to the least significant
bits of the result. Bits [7,0]
of range
specify the index to
the first bit in the range to be extracted, and bits [15,8]
specify the length of the range.
Only bits up to size_of::<T>()*8 - 1
are extracted.
The extracted bits are written in the result starting from the least-significant bit. The high-order bits of the result are zeroed.
Instructions
BEXTR
:- Description: Bit field extract (with immediate).
- Architecture: x86.
- Instruction set: TBM.
- Registers: 32/64 bit.
Example
assert_eq!( 0b0000_0000_0101_0000_u16.bextri(0b0100_0000_0100_u32), 0b0000_0000_0000_0101_u16 );
Implementors
impl Bextr for u8
impl Bextr for u16
impl Bextr for i8
impl Bextr for i16
impl Bextr for u32
impl Bextr for i32
impl Bextr for u64
impl Bextr for i64