diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/support/bits.cpp | 2 | ||||
-rw-r--r-- | src/wasm.h | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/support/bits.cpp b/src/support/bits.cpp index 3d03b100c..aa72201f4 100644 --- a/src/support/bits.cpp +++ b/src/support/bits.cpp @@ -68,7 +68,7 @@ int CountTrailingZeroes<uint32_t>(uint32_t v) { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; - return v ? (int)tbl[((uint32_t)((v & -(int32_t)v) * 0x077CB531U)) >> 27] : 32; + return v ? (int)tbl[((uint32_t)((v & -v) * 0x077CB531U)) >> 27] : 32; } template<> diff --git a/src/wasm.h b/src/wasm.h index f9d0cb129..fabc702c5 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -409,8 +409,8 @@ public: Literal add(const Literal& other) const { switch (type) { - case WasmType::i32: return Literal(i32 + other.i32); - case WasmType::i64: return Literal(i64 + other.i64); + case WasmType::i32: return Literal(uint32_t(i32) + uint32_t(other.i32)); + case WasmType::i64: return Literal(uint64_t(i64) + uint64_t(other.i64)); case WasmType::f32: return Literal(getf32() + other.getf32()); case WasmType::f64: return Literal(getf64() + other.getf64()); default: WASM_UNREACHABLE(); @@ -418,8 +418,8 @@ public: } Literal sub(const Literal& other) const { switch (type) { - case WasmType::i32: return Literal(i32 - other.i32); - case WasmType::i64: return Literal(i64 - other.i64); + case WasmType::i32: return Literal(uint32_t(i32) - uint32_t(other.i32)); + case WasmType::i64: return Literal(uint64_t(i64) - uint64_t(other.i64)); case WasmType::f32: return Literal(getf32() - other.getf32()); case WasmType::f64: return Literal(getf64() - other.getf64()); default: WASM_UNREACHABLE(); @@ -427,8 +427,8 @@ public: } Literal mul(const Literal& other) const { switch (type) { - case WasmType::i32: return Literal(i32 * other.i32); - case WasmType::i64: return Literal(i64 * other.i64); + case WasmType::i32: return Literal(uint32_t(i32) * uint32_t(other.i32)); + case WasmType::i64: return Literal(uint64_t(i64) * uint64_t(other.i64)); case WasmType::f32: return Literal(getf32() * other.getf32()); case WasmType::f64: return Literal(getf64() * other.getf64()); default: WASM_UNREACHABLE(); |