From 85f814e17f7d4e8d665fee4281831c8f4576e40f Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Mon, 28 Mar 2016 15:12:17 +0300 Subject: Fix function trapIfGt() to operate on 64-bit integers even when building a 32-bit executable. --- src/wasm-interpreter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm-interpreter.h') diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 9aadccb59..00a3db0c6 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -695,7 +695,7 @@ private: template size_t getFinalAddress(LS* curr, Literal ptr) { - auto trapIfGt = [this](size_t lhs, size_t rhs, const char* msg) { + auto trapIfGt = [this](uint64_t lhs, uint64_t rhs, const char* msg) { if (lhs > rhs) { std::stringstream ss; ss << msg << ": " << lhs << " > " << rhs; -- cgit v1.2.3 From a471455c7fb4ffc01badedbb2ac9328a646f4693 Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Mon, 28 Mar 2016 16:01:56 +0300 Subject: Clean up src\wasm-interpreter.h(286): warning C4800: 'int64_t': forcing value to bool 'true' or 'false' (performance warning) --- src/wasm-interpreter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm-interpreter.h') diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 00a3db0c6..5f51ff253 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -283,7 +283,7 @@ private: if (curr->condition) { Flow conditionFlow = visit(curr->condition); if (conditionFlow.breaking()) return conditionFlow; - condition = conditionFlow.value.getInteger(); + condition = conditionFlow.value.getInteger() != 0; } return condition ? flow : Flow(); } -- cgit v1.2.3 From bce9c632434bafd99bc18e57a0ba077785b333fa Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Mon, 28 Mar 2016 16:03:19 +0300 Subject: Clean up src\wasm-interpreter.h(307): warning C4244: 'argument': conversion from 'int64_t' to 'unsigned int', possible loss of data --- src/wasm-interpreter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm-interpreter.h') diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 5f51ff253..6f3d872fa 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -304,7 +304,7 @@ private: Name target = curr->default_; if (index >= 0 && (size_t)index < curr->targets.size()) { - target = curr->targets[index]; + target = curr->targets[(size_t)index]; } flow.breakTo = target; return flow; -- cgit v1.2.3 From 6f7f0286a93a0356f8548760082d082bede57ed8 Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Mon, 28 Mar 2016 16:04:49 +0300 Subject: Clean up src\wasm-interpreter.h(644): warning C4244: 'initializing': conversion from 'double' to 'int64_t', possible loss of data. --- src/wasm-interpreter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm-interpreter.h') diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 6f3d872fa..e7a5d6d14 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -641,7 +641,7 @@ private: if (val > (double)std::numeric_limits::max() || val < (double)std::numeric_limits::min()) trap("i32.truncSFloat overflow"); return Literal(int32_t(val)); } else { - int64_t converted = val; + int64_t converted = (int64_t)val; if ((val >= 1 && converted <= 0) || val < (double)LLONG_MIN) trap("i64.truncSFloat overflow"); return Literal(converted); } @@ -654,7 +654,7 @@ private: if (val > (double)std::numeric_limits::max() || val <= (double)-1) trap("i32.truncUFloat overflow"); return Literal(uint32_t(val)); } else { - uint64_t converted = val; + uint64_t converted = (uint64_t)val; if (converted < val - 1 || val <= (double)-1) trap("i64.truncUFloat overflow"); return Literal(converted); } -- cgit v1.2.3