on c3c52cd help sign in
elk/libraries/Native/Bitwise.js
25 lines 796 B history raw
1Elm.Native.Bitwise = {};
2Elm.Native.Bitwise.make = function(elm) {
3 elm.Native = elm.Native || {};
4 elm.Native.Bitwise = elm.Native.Bitwise || {};
5 if (elm.Native.Bitwise.values) return elm.Native.Bitwise.values;
7 function and(a,b) { return a & b; }
8 function or (a,b) { return a | b; }
9 function xor(a,b) { return a ^ b; }
10 function not(a) { return ~a; }
11 function sll(a,offset) { return a << offset; }
12 function sra(a,offset) { return a >> offset; }
13 function srl(a,offset) { return a >>> offset; }
15 return elm.Native.Bitwise.values = {
16 and: F2(and),
17 or : F2(or ),
18 xor: F2(xor),
19 complement: not,
20 shiftLeft : F2(sll),
21 shiftRightArithmatic: F2(sra),
22 shiftRightLogical : F2(srl)
23 };
25};