@@ -0,0 +1,53 @@
1+
2+module Bits where
3+
4+{-| Library for [bitwise operations](http://en.wikipedia.org/wiki/Bitwise_operation).
5+
6+@docs and, or, xor, complement, shiftLeft, shiftRight, shiftRightLogical
7+-}
8+
9+import Native.Bits
10+
11+{-| Performs the AND operation on each pair of bits.
12+-}
13+and : Int -> Int -> Int
14+and = Native.Bits.and
15+
16+{-| Performs the OR operation on each pair of bits.
17+-}
18+or : Int -> Int -> Int
19+or = Native.Bits.or
20+
21+{-| Performs the XOR operation on each pair of bits.
22+-}
23+xor : Int -> Int -> Int
24+xor = Native.Bits.xor
25+
26+{-| Performs the NOT operation on each bit.
27+-}
28+complement : Int -> Int
29+complement = Native.Bits.complement
30+
31+{-| Shift bits to the left by a given offset, filling new bits with zeros.
32+-}
33+shiftLeft : Int -> Int -> Int
34+shiftLeft = Native.Bits.shiftLeft
35+
36+{-| Shift bits to the right by a given offset, filling new bits with
37+whatever is the topmost bit. This is an [arithmatic right
38+shift](http://en.wikipedia.org/wiki/Bitwise_operation#Arithmetic_shift),
39+often written (>>), and sometimes called a “sign-propagating”
40+right shift because it fills empty spots with copies of the highest bit.
41+-}
42+shiftRight : Int -> Int -> Int
43+shiftRight = Native.Bits.shiftRightArithmatic
44+
45+{-| Shift bits to the right by a given offset, filling new bits with
46+zeros. This is an [logical right
47+shift](http://en.wikipedia.org/wiki/Bitwise_operation#Logical_shift), often written (>>>),
48+and sometimes called a “zero-fill” right shift because it fills empty spots
49+with zeros.
50+-}
51+shiftRightLogical : Int -> Int -> Int
52+shiftRightLogical = Native.Bits.shiftRightLogical
53+