Renamed to nodef/extra-bit.elm. That is where the repository lives now. It has not been published as a package under the new name.
Versions published as elmw/extra-bit still install under that name. 15 versions of 15 come from the new location (see their notes).
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/nodef/extra-bit.elm.
What we checked: The repo moved to github.com/nodef/extra-bit.elm. Rebuilt with git archive from commit cf5d7f078fcf of https://github.com/nodef/extra-bit.elm (zip prefix elmw-extra-bit-5773072/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 b06ac25b3979b4f71c365b745545139fd677fc57.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/elmw/extra-bit/zipball/1.0.2/
The bit is a basic unit of information in information theory, computing. This package includes bit twiddling hacks by Sean Eron Anderson and many others.
Get a bit.
-- x: an Int
-- i: bit index
get 6 0 == 0 (110,0 => 0)
get 6 1 == 1 (110,1 => 1)
get 6 2 == 1 (110,2 => 1)Get bits as per mask.
-- x: an Int
-- m: bit mask
getAs 6 4 == 4 (110,100 => 100)
getAs 6 7 == 6 (110,111 => 110)
getAs 6 5 == 4 (110,101 => 100)Interleave bits of two Int16s.
-- x: first Int16
-- y: second Int16
interleave 0x0000 0xFFFF == 1431655765 (0x55555555)
interleave 0x1234 0x1234 == 51121968 (0x030C0F30)
interleave 0x1234 0x4321 == 302845473 (0x120D0E21)Merge bits as per mask.
-- x: first Int
-- y: second Int
-- m: bit mask (0 => from x)
merge 0x12 0x24 0x0F == 20 (0x14)
merge 0x1234 0xABCD 0x0F0F == 6973 (0x1B3D)
merge 0xAAAA 0xBBBB 0x3333 == 48059 (0xBBBB)Get n-bit parity.
-- x: an Int
-- n: number of bits (1)
parity 7 1 == 1 (1,1,1 => 1)
parity 5 1 == 0 (1,0,1 => 0)
parity 8 2 == 2 (10,00 => 10)
parity 63 4 == 12 (11,1111 => 1100)Reverse all bits.
-- x: an Int
reverse 0xFFFF0000 == 65535 (0x0000FFFF)
reverse 0x00AABBCC == 870143232 (0x33DD5500)
reverse 0x1234 == 742916096 (0x2C480000)Rotate bits.
-- x: an Int
-- n: rotate amount (+ve: left, -ve: right)
rotate 0x11112222 4 == 286401057 (0x11122221)
rotate 0x11112222 -4 == 554766882 (0x21111222)Get index of first set bit from LSB.
-- x: an Int
scan 7 == 0 (111 => 0)
scan 12 == 2 (1100 => 2)
scan 64 == 6 (1000000 => 6)Gets index of first set bit from MSB.
-- x: an Int
scanReverse 13 == 3 (1101 => 3)
scanReverse 5 == 2 (101 => 2)
scanReverse 1 == 0 (1 => 0)Set a bit.
-- x: an Int
-- i: bit index
-- f: bit value (1)
set 6 0 1 == 7 (110,0,1 => 111)
set 6 2 1 == 6 (110,2,1 => 110)
set 6 2 0 == 2 (110,2,0 => 010)Set bits as per mask.
-- x: an Int
-- m: bit mask
-- f: bit value (1)
setAs 8 2 1 == 10 (0x8 set 0x2 => 0xA)
setAs 15 3 0 == 12 (0xF clear 0x3 => 0xC)
setAs 0x1234 0x430 1 == 5684 (0x1234 set 0x430 => 0x1634)Sign extend variable bit-width integer.
-- x: variable bit-width Int
-- w: bit width (32)
signExtend 15 4 == -1 (1111 => -1)
signExtend 3 3 == 3 (011 => 3)
signExtend 4 3 == -4 (100 => -4)Swap bit sequences.
-- x: an Int
-- i: first bit index
-- j: second bit index
-- n: bit width (1)
swap 6 1 0 1 == 5 (110 => 101)
swap 0x1234 8 4 4 == 4900 (0x1234 => 0x1324)
swap 0x4AAB 8 0 8 == 43850 (0x4AAB => 0xAB4A)Toggle a bit.
-- x: an Int
-- i: bit index
toggle 6 0 == 7 (110,0 => 111)
toggle 6 1 == 4 (110,1 => 100)
toggle 6 2 == 2 (110,2 => 010)Toggle bits as per mask.
-- x: an Int
-- m: bit mask
toggleAs 6 1 == 7 (110,000 => 111)
toggleAs 6 7 == 1 (110,111 => 001)
toggleAs 6 3 == 5 (110,011 => 101)
Count bits set.