diff options
author | Bruce Mitchener <bruce.mitchener@gmail.com> | 2013-03-05 18:10:31 +0700 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2013-03-07 00:19:53 +0700 |
commit | 65d5914ecb5c3c8c16722712657a9f16b73962d9 (patch) | |
tree | 7ce40d2ada2228e74099b19147361b78a269892e /src/long.js | |
parent | 97407b218c6d816e964f1faa1420db46ea1fec3c (diff) |
Implement llabs().
Diffstat (limited to 'src/long.js')
-rw-r--r-- | src/long.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/long.js b/src/long.js index c3b0e605..c3651bd9 100644 --- a/src/long.js +++ b/src/long.js @@ -1551,6 +1551,17 @@ var i64Math = (function() { // Emscripten wrapper HEAP32[tempDoublePtr>>2] = ret.low_; HEAP32[tempDoublePtr+4>>2] = ret.high_; }, + abs: function(l, h) { + var x = new goog.math.Long(l, h); + var ret; + if (x.isNegative()) { + ret = x.negate(); + } else { + ret = x; + } + HEAP32[tempDoublePtr>>2] = ret.low_; + HEAP32[tempDoublePtr+4>>2] = ret.high_; + }, ensureTemps: function() { if (Wrapper.ensuredTemps) return; Wrapper.ensuredTemps = true; |