aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-16 11:13:08 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-11-16 11:26:55 -0800
commit76071e42f3dcb22fec93c0ea963710988b566df0 (patch)
treef8a22498d9ea0aef9bdae9dfa43a485b8f705909 /src/library.js
parent9953de1d753ccf77494b42b0c19577413e5de6a1 (diff)
print out hexadecimal 64-bit values properly, and fix some bugs with I64_PRECISE mode 2; fixes #716
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/library.js b/src/library.js
index fd5e0fae..eb4aad40 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2741,7 +2741,7 @@ LibraryManager.library = {
var signed = next == 'd'.charCodeAt(0) || next == 'i'.charCodeAt(0);
argSize = argSize || 4;
var currArg = getNextArg('i' + (argSize * 8));
-#if PRECISE_I64_MATH == 1
+#if PRECISE_I64_MATH
var origArg = currArg;
#endif
var argText;
@@ -2760,12 +2760,12 @@ LibraryManager.library = {
var currAbsArg = Math.abs(currArg);
var prefix = '';
if (next == 'd'.charCodeAt(0) || next == 'i'.charCodeAt(0)) {
-#if PRECISE_I64_MATH == 1
- if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1]); else
+#if PRECISE_I64_MATH
+ if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1], null); else
#endif
argText = reSign(currArg, 8 * argSize, 1).toString(10);
} else if (next == 'u'.charCodeAt(0)) {
-#if PRECISE_I64_MATH == 1
+#if PRECISE_I64_MATH
if (argSize == 8 && i64Math) argText = i64Math.stringify(origArg[0], origArg[1], true); else
#endif
argText = unSign(currArg, 8 * argSize, 1).toString(10);
@@ -2774,6 +2774,9 @@ LibraryManager.library = {
argText = (flagAlternative ? '0' : '') + currAbsArg.toString(8);
} else if (next == 'x'.charCodeAt(0) || next == 'X'.charCodeAt(0)) {
prefix = flagAlternative ? '0x' : '';
+#if PRECISE_I64_MATH
+ if (argSize == 8 && i64Math) argText = (origArg[1]>>>0).toString(16) + (origArg[0]>>>0).toString(16); else
+#endif
if (currArg < 0) {
// Represent negative numbers in hex as 2's complement.
currArg = -currArg;