Commit 716e539c authored by Karl Schimpf's avatar Karl Schimpf Committed by Commit Bot

[wasm] Use static_assert instead of assert

Fixes nits found by @clemensh after
CL https://chromium-review.googlesource.com/c/v8/v8/+/834670
was committed. That is, the code uses static asserts instead of
assert.

Bug: v8:7226
Change-Id: I5488ec4609d1bee3aafa61a3ff2505f71b06d80d
Reviewed-on: https://chromium-review.googlesource.com/847687Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Karl Schimpf <kschimpf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50388}
parent da72b856
......@@ -2876,16 +2876,16 @@ WASM_EXEC_TEST(I32SConvertSatF32) {
WasmRunner<int32_t, float> r(execution_mode);
BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
constexpr float kLowerBound =
static_cast<float>(std::numeric_limits<int32_t>::min());
constexpr float kUpperBound =
static_cast<float>(std::numeric_limits<int32_t>::max());
assert(static_cast<int64_t>(kUpperBound) >
static_cast<int64_t>(std::numeric_limits<int32_t>::max()));
assert(static_cast<int32_t>(kLowerBound) ==
std::numeric_limits<int32_t>::min());
constexpr float kLowerBound = std::numeric_limits<int32_t>::min();
constexpr float kUpperBound = std::numeric_limits<int32_t>::max();
FOR_FLOAT32_INPUTS(i) {
static_assert(static_cast<int64_t>(kUpperBound) >
static_cast<int64_t>(std::numeric_limits<int32_t>::max()),
"kUpperBound invalidates the following bounds check.");
static_assert(static_cast<int32_t>(kLowerBound) ==
std::numeric_limits<int32_t>::min(),
"kLowerBounds invalidates the following bounds check.");
if (*i < kUpperBound && *i >= kLowerBound) {
CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i));
} else if (std::isnan(*i)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment