aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-08 12:08:14 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-08 12:08:14 -0800
commit2bad54228396018829d6c50d50a8e27daeeb66b7 (patch)
tree51a6bee374235cf8597b083ae4353c9695de5535 /src
parentbdc218622d510f026545f73c78f3a15ae6972fb3 (diff)
fix for double mode 1 issue with 32-bit floats being NaNs and altering our doubles
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js8
-rw-r--r--src/preamble.js2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 71e8a771..92a360ad 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -907,8 +907,8 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
}
if (DOUBLE_MODE == 1 && USE_TYPED_ARRAYS == 2 && type == 'double') {
- return '(tempDoubleF32[0]=' + makeGetValue(ptr, pos, 'float', noNeedFirst, unsigned, ignore) + ',' +
- 'tempDoubleF32[1]=' + makeGetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('float')), 'float', noNeedFirst, unsigned, ignore) + ',' +
+ return '(tempDoubleI32[0]=' + makeGetValue(ptr, pos, 'i32', noNeedFirst, unsigned, ignore, align) + ',' +
+ 'tempDoubleI32[1]=' + makeGetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'i32', noNeedFirst, unsigned, ignore, align) + ',' +
'tempDoubleF64[0])';
}
@@ -990,8 +990,8 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe)
if (DOUBLE_MODE == 1 && USE_TYPED_ARRAYS == 2 && type == 'double') {
return '(tempDoubleF64[0]=' + value + ',' +
- makeSetValue(ptr, pos, 'tempDoubleF32[0]', 'float', noNeedFirst, ignore, align/2) + ',' +
- makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'tempDoubleF32[1]', 'float', noNeedFirst, ignore, align/2) + ')';
+ makeSetValue(ptr, pos, 'tempDoubleI32[0]', 'i32', noNeedFirst, ignore, align) + ',' +
+ makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'tempDoubleI32[1]', 'i32', noNeedFirst, ignore, align) + ')';
}
if (EMULATE_UNALIGNED_ACCESSES && USE_TYPED_ARRAYS == 2 && align && isIntImplemented(type)) { // TODO: support unaligned doubles and floats
diff --git a/src/preamble.js b/src/preamble.js
index 1c614e21..3b4a4a01 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -341,7 +341,7 @@ var tempI64, tempI64b;
#if DOUBLE_MODE == 1
#if USE_TYPED_ARRAYS == 2
var tempDoubleBuffer = new ArrayBuffer(8);
-var tempDoubleF32 = new Float32Array(tempDoubleBuffer);
+var tempDoubleI32 = new Int32Array(tempDoubleBuffer);
var tempDoubleF64 = new Float64Array(tempDoubleBuffer);
#endif
#endif