Trait bitintr::Pext [] [src]

pub trait Pext {
    fn pext(self, mask: Self) -> Self;
}

Parallel bits extract

Required Methods

Parallel bits extract.

Gathers the bits of x specified by the mask_ into the contiguous low order bit positions of the result.

The remaining high-order bits of the result are set to zero.

Keywords: Parallel bits extract, gather bits.

Instructionss

  • PEXT:
    • Description: Parallel bits extract.
    • Architecture: x86.
    • Instruction set: BMI2.
    • Registers: 32/64 bit.

Example

let n  = 0b1011_1110_1001_0011u16;

let m0 = 0b0110_0011_1000_0101u16;
let s0 = 0b0000_0000_0011_0101u16;

let m1 = 0b1110_1011_1110_1111u16;
let s1 = 0b0001_0111_0100_0011u16;

assert_eq!(n.pext(m0), s0);
assert_eq!(n.pext(m1), s1);

Implementors