Function bitintr::x86::bmi2::pext [] [src]

pub fn pext<T: Int>(x: T, mask: T) -> T

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.

Assembly Instructions

Example

use bitintr::x86::bmi2::*;

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!(pext(n, m0), s0);
assert_eq!(n.pext(m1), s1);