on master help sign in
Actually switch to the new module name
9c9fcc7Evan Czaplicki
libraries/Bitwise.elm+9−9
@@ -1,5 +1,5 @@
1
1
2−module Bits where
2+module Bitwise where
3
3
4{-| Library for [bitwise operations](http://en.wikipedia.org/wiki/Bitwise_operation).
4{-| Library for [bitwise operations](http://en.wikipedia.org/wiki/Bitwise_operation).
5
5
@@ -12,27 +12,27 @@ module Bits where
12@docs shiftLeft, shiftRight, shiftRightLogical
12@docs shiftLeft, shiftRight, shiftRightLogical
13-}
13-}
14
14
15−import Native.Bits
15+import Native.Bitwise
16
16
17{-| Bitwise “and”
17{-| Bitwise “and”
18-}
18-}
19and : Int -> Int -> Int
19and : Int -> Int -> Int
20−and = Native.Bits.and
20+and = Native.Bitwise.and
21
21
22{-| Bitwise “or”
22{-| Bitwise “or”
23-}
23-}
24or : Int -> Int -> Int
24or : Int -> Int -> Int
25−or = Native.Bits.or
25+or = Native.Bitwise.or
26
26
27{-| Bitwise “xor”
27{-| Bitwise “xor”
28-}
28-}
29xor : Int -> Int -> Int
29xor : Int -> Int -> Int
30−xor = Native.Bits.xor
30+xor = Native.Bitwise.xor
31
31
32{-| Flip each bit individually, often called “bitwise not”
32{-| Flip each bit individually, often called “bitwise not”
33-}
33-}
34complement : Int -> Int
34complement : Int -> Int
35−complement = Native.Bits.complement
35+complement = Native.Bitwise.complement
36
36
37{-| Shift bits to the left by a given offset, filling new bits with zeros.
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.
38This can be used to multiply numbers by powers of two.
@@ -41,7 +41,7 @@ This can be used to multiply numbers by powers of two.
41 8 `shiftLeft` 2 == 32
41 8 `shiftLeft` 2 == 32
42-}
42-}
43shiftLeft : Int -> Int -> Int
43shiftLeft : Int -> Int -> Int
44−shiftLeft = Native.Bits.shiftLeft
44+shiftLeft = Native.Bitwise.shiftLeft
45
45
46{-| Shift bits to the right by a given offset, filling new bits with
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.
47whatever is the topmost bit. This can be used to divide numbers by powers of two.
@@ -56,7 +56,7 @@ often written (>>), and sometimes called a “sign-propagating”
56right shift because it fills empty spots with copies of the highest bit.
56right shift because it fills empty spots with copies of the highest bit.
57-}
57-}
58shiftRight : Int -> Int -> Int
58shiftRight : Int -> Int -> Int
59−shiftRight = Native.Bits.shiftRightArithmatic
59+shiftRight = Native.Bitwise.shiftRightArithmatic
60
60
61{-| Shift bits to the right by a given offset, filling new bits with
61{-| Shift bits to the right by a given offset, filling new bits with
62zeros.
62zeros.
@@ -71,5 +71,5 @@ and sometimes called a “zero-fill” right shift because it fills empt
71with zeros.
71with zeros.
72-}
72-}
73shiftRightLogical : Int -> Int -> Int
73shiftRightLogical : Int -> Int -> Int
74−shiftRightLogical = Native.Bits.shiftRightLogical
74+shiftRightLogical = Native.Bitwise.shiftRightLogical
75
75
libraries/Native/Bitwise.js+5−5
@@ -1,8 +1,8 @@
1−Elm.Native.Bits = {};
1+Elm.Native.Bitwise = {};
2−Elm.Native.Bits.make = function(elm) {
2+Elm.Native.Bitwise.make = function(elm) {
3 elm.Native = elm.Native || {};
3 elm.Native = elm.Native || {};
4− elm.Native.Bits = elm.Native.Bits || {};
4+ elm.Native.Bitwise = elm.Native.Bitwise || {};
5− if (elm.Native.Bits.values) return elm.Native.Bits.values;
5+ if (elm.Native.Bitwise.values) return elm.Native.Bitwise.values;
6
6
7 function and(a,b) { return a & b; }
7 function and(a,b) { return a & b; }
8 function or (a,b) { return a | b; }
8 function or (a,b) { return a | b; }
@@ -12,7 +12,7 @@ Elm.Native.Bits.make = function(elm) {
12 function sra(a,offset) { return a >> offset; }
12 function sra(a,offset) { return a >> offset; }
13 function srl(a,offset) { return a >>> offset; }
13 function srl(a,offset) { return a >>> offset; }
14
14
15− return elm.Native.Bits.values = {
15+ return elm.Native.Bitwise.values = {
16 and: A2(and),
16 and: A2(and),
17 or : A2(or ),
17 or : A2(or ),
18 xor: A2(xor),
18 xor: A2(xor),