summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-01-10 19:51:50 -0800
committerJF Bastien <jfb@chromium.org>2016-01-10 19:51:50 -0800
commit16ed70cb09569b881b6416955000fa7902119264 (patch)
treeccb918854d1c658690c8692f47022158f6d1e7e5 /src
parente3c38c14e7dd9c115da960daafd109d2687f1a08 (diff)
downloadbinaryen-16ed70cb09569b881b6416955000fa7902119264.tar.gz
binaryen-16ed70cb09569b881b6416955000fa7902119264.tar.bz2
binaryen-16ed70cb09569b881b6416955000fa7902119264.zip
Asm2WasmBuilder: allow building u/s int32.
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index c72c7e98a..7992de8af 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -385,8 +385,9 @@ private:
}
if (ast[1] == MINUS && ast[2][0] == NUM) {
double num = -ast[2][1]->getNumber();
- assert(isSInteger32(num));
- return Literal((int32_t)num);
+ if (isSInteger32(num)) return Literal((int32_t)num);
+ if (isUInteger32(num)) return Literal((uint32_t)num);
+ assert(false && "expected signed or unsigned int32");
}
if (ast[1] == PLUS && ast[2][0] == UNARY_PREFIX && ast[2][1] == MINUS && ast[2][2][0] == NUM) {
return Literal((double)-ast[2][2][1]->getNumber());