-
Notifications
You must be signed in to change notification settings - Fork 0
merge
Subhajit Sahu edited this page Jan 17, 2021
·
7 revisions
Merges bits as per mask. 🏃 📼 📦 🌔 📒
Similar: merge, interleave.
bit.merge(x, y, m);
// x: first int32
// y: second int32
// m: bit mask (0 => from x)
const bit = require('extra-bit');
bit.merge(0x12, 0x24, 0x0F);
// 20 (0x14)
bit.merge(0x1234, 0xABCD, 0x0F0F);
// 6973 (0x1B3D)
bit.merge(0xAAAA, 0xBBBB, 0x3333);
// 48059 (0xBBBB)