-
Notifications
You must be signed in to change notification settings - Fork 1
interleave
Subhajit Sahu edited this page Jul 25, 2022
·
14 revisions
Interleave bits of two int16s.
Similar: merge, interleave.
interleave(x, y)
// x: first int16
// y: second int16
// → int32
const xbit = require('extra-bit');
xbit.interleave(0x0000, 0xFFFF);
// → 1431655765 (0x55555555)
xbit.interleave(0x1234, 0x1234);
// → 51121968 (0x030C0F30)
xbit.interleave(0x1234, 0x4321);
// → 302845473 (0x120D0E21)