diff options
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | src/wasm-interpreter.h | 5 |
2 files changed, 3 insertions, 4 deletions
@@ -4,5 +4,5 @@ echo "building interpreter/js" em++ -std=c++11 src/wasm-js.cpp src/parser.cpp src/simple_ast.cpp src/optimizer-shared.cpp -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -s DEMANGLE_SUPPORT=1 -O3 -profiling -s TOTAL_MEMORY=67108864 -s SAFE_HEAP=1 -s ASSERTIONS=1 #-DWASM_JS_DEBUG #-DWASM_INTERPRETER_DEBUG cat src/js/post.js >> bin/wasm.js echo "building wasm shell" -g++ -O2 -std=c++11 src/wasm-shell.cpp -g -o bin/wasm-shell +#g++ -O2 -std=c++11 src/wasm-shell.cpp -g -o bin/wasm-shell diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 2c8a2bacd..0ca4d9674 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -334,20 +334,19 @@ public: } if (value.type == i64) { int64_t v = value.geti64(); + int32_t high = v >> 32, low = v; switch (curr->op) { case Clz: { if (v == 0) return Literal((int64_t)64); - int32_t high = v >> 32, low = v; if (high == 0) return Literal(32+(int64_t)safe_clz(low)); return Literal((int64_t)safe_clz(high)); } case Ctz: { if (v == 0) return Literal((int64_t)64); - int32_t high = v >> 32, low = v; if (low == 0) return Literal(32+(int64_t)safe_ctz(high)); return Literal((int64_t)safe_ctz(low)); } - case Popcnt: return Literal((int64_t)__builtin_popcount(v)); + case Popcnt: return Literal(int64_t(__builtin_popcount(low) + __builtin_popcount(high))); default: abort(); } } |