summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index db7cc1ae0..c72c7e98a 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -385,7 +385,7 @@ private:
}
if (ast[1] == MINUS && ast[2][0] == NUM) {
double num = -ast[2][1]->getNumber();
- assert(isInteger32(num));
+ assert(isSInteger32(num));
return Literal((int32_t)num);
}
if (ast[1] == PLUS && ast[2][0] == UNARY_PREFIX && ast[2][1] == MINUS && ast[2][2][0] == NUM) {
@@ -912,9 +912,12 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
} else if (what == NUM) {
auto ret = allocator.alloc<Const>();
double num = ast[1]->getNumber();
- if (isInteger32(num)) {
+ if (isSInteger32(num)) {
ret->value.type = WasmType::i32;
- ret->value.i32 = toInteger32(num);
+ ret->value.i32 = toSInteger32(num);
+ } else if (isUInteger32(num)) {
+ ret->value.type = WasmType::i32;
+ ret->value.i32 = toUInteger32(num);
} else {
ret->value.type = WasmType::f64;
ret->value.f64 = num;