Skip to main content

bernoulli_compare_avx2

Function bernoulli_compare_avx2 

Source
pub unsafe fn bernoulli_compare_avx2(buf: &[u8], threshold: u8) -> u32
Expand description

Compare 32 random bytes against an unsigned threshold and return bit mask.

Bit i in the returned mask is 1 iff buf[i] < threshold.

ยงSafety

Caller must ensure the current CPU supports avx2. buf must have at least 32 elements.