diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-interpreter.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index b8fcf2509..55eb2e269 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -367,8 +367,9 @@ public: if (val > (double)INT_MAX || val < (double)INT_MIN) instance.externalInterface->trap(); return Flow(Literal(int32_t(val))); } else { - if (val > (double)LLONG_MAX || val < (double)LLONG_MIN) instance.externalInterface->trap(); - return Flow(Literal(int64_t(val))); + int64_t converted = val; + if ((val > 0 && converted <= 0) || val < (double)LLONG_MIN) instance.externalInterface->trap(); + return Flow(Literal(converted)); } } case TruncUFloat32: |