diff options
author | JF Bastien <jfb@chromium.org> | 2016-01-10 19:51:50 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2016-01-10 19:51:50 -0800 |
commit | 16ed70cb09569b881b6416955000fa7902119264 (patch) | |
tree | ccb918854d1c658690c8692f47022158f6d1e7e5 /src | |
parent | e3c38c14e7dd9c115da960daafd109d2687f1a08 (diff) | |
download | binaryen-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.h | 5 |
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()); |