[][src]Function qip::utils::entwine_bits

pub fn entwine_bits(n: u64, selector: u64, off_bits: u64, on_bits: u64) -> u64

Mixes two bitstreams, z_bits and o_bits, takes one bit off the lowest position from each to construct the output, selector is used to choose which to use. 0 indices z_bits a

Example

use qip::utils::entwine_bits;

let n = 3;
let off_bits = 0b01; // 2 bits from off
let on_bits = 0b1;  // 1 bit from on
let selector = 0b010; // first take from off, then on, then off
assert_eq!(entwine_bits(n, selector, off_bits, on_bits), 0b011);