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

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

Parallel bits deposit.

Scatter contiguous low order bits of x to the result at the positions specified by the mask_.

All other bits (bits not set in the mask) of the result are set to zero.

Keywords: Parallel bits deposit, scatter bits.

Assembly Instructions

Example

use bitintr::x86::bmi2::*;
let n  = 0b1011_1110_1001_0011u16;

let m0 = 0b0110_0011_1000_0101u16;
let s0 = 0b0000_0010_0000_0101u16;

let m1 = 0b1110_1011_1110_1111u16;
let s1 = 0b1110_1001_0010_0011u16;

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