Skip to content

interleave

Subhajit Sahu edited this page Feb 3, 2021 · 14 revisions

Interleaves bits of two int16s. 📦 😺 🏃 📼 🌔 📜 📰 📘

Similar: merge, interleave.


bit.interleave(x, y);
// x: first int16
// y: second int16
// → int32
const bit = require("extra-bit");

bit.interleave(0x0000, 0xFFFF);
// 1431655765 (0x55555555)

bit.interleave(0x1234, 0x1234);
// 51121968 (0x030C0F30)

bit.interleave(0x1234, 0x4321);
// 302845473 (0x120D0E21)


References

Clone this wiki locally