diff options
author | JF Bastien <jfb@chromium.org> | 2015-12-23 16:15:28 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2015-12-23 16:15:28 -0800 |
commit | 686551ec7012aa293730c4836edfe3003b519d95 (patch) | |
tree | 12cefd6c30de265532452e4edc74c7af51689f7c /src/wasm-interpreter.h | |
parent | fa3d3bab09730f7bbce4e6d6889ebda3be3795d6 (diff) | |
download | binaryen-686551ec7012aa293730c4836edfe3003b519d95.tar.gz binaryen-686551ec7012aa293730c4836edfe3003b519d95.tar.bz2 binaryen-686551ec7012aa293730c4836edfe3003b519d95.zip |
clz32: handle 0 as with ctz
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 0d32dcf52..9e4f38d1a 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -360,7 +360,9 @@ private: if (value.type == i32) { int32_t v = value.geti32(); switch (curr->op) { - case Clz: return Literal(CountLeadingZeroes((uint32_t)v)); + case Clz: + if (v == 0) return Literal(32); + return Literal(CountLeadingZeroes((uint32_t)v)); case Ctz: { if (v == 0) return Literal(32); return Literal(CountTrailingZeroes((uint32_t)v)); |