From f32ab820be47c968685dc5e24e27218bb0c9861c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Oct 2015 20:09:15 -0700 Subject: fix large int constants --- src/asm2wasm.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src') 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(); double num = ast[1]->getNumber(); - if (isInteger(num)) { + if (isInteger32(num)) { ret->value.type = BasicType::i32; ret->value.i32 = num; } else { -- cgit v1.2.3