diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-05-25 07:16:26 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-05-25 07:16:26 -0700 |
commit | f0b0519c989c4b3a418857ac2d54c09c36966b76 (patch) | |
tree | 1e96dd016a63566a625ab1424673b5524bc409fc /src/runtime.js | |
parent | a33bd79873b6872c7fab3fa4992ef9749f2c0aa5 (diff) |
64-bit bitops
Diffstat (limited to 'src/runtime.js')
-rw-r--r-- | src/runtime.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime.js b/src/runtime.js index b0378e08..1aefc135 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -85,6 +85,22 @@ Runtime = { INT_TYPES: set('i1', 'i8', 'i16', 'i32', 'i64'), FLOAT_TYPES: set('float', 'double'), + or64: function(x, y) { + var l = (x | 0) | (y | 0); + var h = (Math.round(x / 4294967296) | Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + and64: function(x, y) { + var l = (x | 0) & (y | 0); + var h = (Math.round(x / 4294967296) & Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + xor64: function(x, y) { + var l = (x | 0) ^ (y | 0); + var h = (Math.round(x / 4294967296) ^ Math.round(y / 4294967296)) * 4294967296; + return l + h; + }, + getNativeFieldSize: getNativeFieldSize, dedup: dedup, |