Skip to content
Subhajit Sahu edited this page Jan 24, 2021 · 5 revisions

Merge bits as per mask. 📰 📘

Similar: merge, interleave.


merge x y m
-- x: first Int
-- y: second Int
-- m: bit mask (0 ⇒ from x)
import Bit exposing (..)

merge 0x12 0x24 0x0F
-- 20 (0x14)

merge 0x1234 0xABCD 0x0F0F
-- 6973 (0x1B3D)

merge 0xAAAA 0xBBBB 0x3333
-- 48059 (0xBBBB)


References

Clone this wiki locally