/**
 * ABABAB gets turned into BBB
 * @param {number} interleaved
 * @returns {number} Odd bits end up in lower 16 bits, even bits end up in top part
 */
export function de_interleave_2_bits(interleaved) {
    let x = interleaved & 0x55555555;

    x = (x | (x >> 1)) & 0x33333333;
    x = (x | (x >> 2)) & 0x0f0f0f0f;
    x = (x | (x >> 4)) & 0x00ff00ff;
    x = (x | (x >> 8)) & 0x0000ffff;

    return x;
}