summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-10-29 20:09:15 -0700
committerAlon Zakai <alonzakai@gmail.com>2015-10-29 20:09:15 -0700
commitf32ab820be47c968685dc5e24e27218bb0c9861c (patch)
tree54f9708bd9721f26551f8ab955461d440f2ef987 /src
parent3e8516cb75e7941da0b16443fbd4b4a298fa3644 (diff)
downloadbinaryen-f32ab820be47c968685dc5e24e27218bb0c9861c.tar.gz
binaryen-f32ab820be47c968685dc5e24e27218bb0c9861c.tar.bz2
binaryen-f32ab820be47c968685dc5e24e27218bb0c9861c.zip
fix large int constants
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/asm2wasm.cpp b/src/asm2wasm.cpp
index 267e36bf6..ac2c1d5e8 100644
--- a/src/asm2wasm.cpp
+++ b/src/asm2wasm.cpp
@@ -343,13 +343,6 @@ private:
return asmToWasmType(detectType(ast, data));
}
- bool isInteger(double num) {
- return fmod(num, 1) == 0 && double(int(num)) == num;
- }
- bool isInteger(Ref ast) {
- return ast[0] == NUM && isInteger(ast[1]->getNumber());
- }
-
bool isUnsignedCoercion(Ref ast) { // TODO: use detectSign?
if (ast[0] == BINARY && ast[1] == TRSHIFT) return true;
return false;
@@ -765,7 +758,7 @@ Function* Asm2WasmModule::processFunction(Ref ast) {
} else if (what == NUM) {
auto ret = allocator.alloc<Const>();
double num = ast[1]->getNumber();
- if (isInteger(num)) {
+ if (isInteger32(num)) {
ret->value.type = BasicType::i32;
ret->value.i32 = num;
} else {