diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-14 09:33:53 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-14 09:33:53 -0700 |
commit | 90c4b12c0b07ca889eb5521b434f5ce258b651a1 (patch) | |
tree | f7e11f81c931542003218b60e6d6aefbd3faea79 /src/library.js | |
parent | eeaacf90a9e80f0b295b16233ea09d1be9cc2222 (diff) |
add handwritten asm i64Subtract
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js index f9864134..a792a681 100644 --- a/src/library.js +++ b/src/library.js @@ -7490,6 +7490,19 @@ LibraryManager.library = { {{{ makeStructuralReturn(['l|0', 'h', 'overflow'], true) }}}; }, + i64Subtract__asm: true, + i64Subtract__sig: 'iiiii', + i64Subtract: function(a, b, c, d) { + a = a|0; b = b|0; c = c|0; d = d|0; + var l = 0, h = 0; + l = (a - c)>>>0; + h = (b - d)>>>0; + if ((l>>>0) > (a>>>0)) { // iff we overflowed + h = (h-1)>>>0; + } + {{{ makeStructuralReturn(['l|0', 'h'], true) }}}; + }, + bitshift64Shl__asm: true, bitshift64Shl__sig: 'iiii', bitshift64Shl: function(low, high, bits) { |