Function bitintr::x86::bmi::bextr [] [src]

pub fn bextr<T: Int>(source: T, start: T, length: T) -> T

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 T::bit_size() - 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.

Assembly Instructions

Example

use bitintr::x86::bmi::*;

assert_eq!(bextr(0b0101_0000u8, 4, 4), 0b0000_0101u8);
assert_eq!(0b0101_0000u8.bextr(4, 4), 0b0000_0101u8);