4{-| Library for [bitwise operations](http://en.wikipedia.org/wiki/Bitwise_operation).
8@docs and, or, xor, complement
12@docs shiftLeft, shiftRight, shiftRightLogical
17{-| Bitwise “and”
19and : Int -> Int -> Int
20and = Native.Bitwise.and
22{-| Bitwise “or”
27{-| Bitwise “xor”
29xor : Int -> Int -> Int
30xor = Native.Bitwise.xor
32{-| Flip each bit individually, often called “bitwise not”
34complement : Int -> Int
35complement = Native.Bitwise.complement
37{-| Shift bits to the left by a given offset, filling new bits with zeros.
38This can be used to multiply numbers by powers of two.
43shiftLeft : Int -> Int -> Int
44shiftLeft = Native.Bitwise.shiftLeft
46{-| Shift bits to the right by a given offset, filling new bits with
47whatever is the topmost bit. This can be used to divide numbers by powers of two.
49 32 `shiftRight` 1 == 16
50 32 `shiftRight` 2 == 8
51 -32 `shiftRight` 1 == -16
53This is called an [arithmatic right
54shift](http://en.wikipedia.org/wiki/Bitwise_operation#Arithmetic_shift),
55often written (>>), and sometimes called a “sign-propagating”
56right shift because it fills empty spots with copies of the highest bit.
58shiftRight : Int -> Int -> Int
59shiftRight = Native.Bitwise.shiftRightArithmatic
61{-| Shift bits to the right by a given offset, filling new bits with
64 32 `shiftRightLogical` 1 == 16
65 32 `shiftRightLogical` 2 == 8
66 -32 `shiftRightLogical` 1 == 2147483632
68This is called an [logical right
69shift](http://en.wikipedia.org/wiki/Bitwise_operation#Logical_shift), often written (>>>),
70and sometimes called a “zero-fill” right shift because it fills empty spots
73shiftRightLogical : Int -> Int -> Int
74shiftRightLogical = Native.Bitwise.shiftRightLogical
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list