Commit c24f67d9 authored by Peter Kasting's avatar Peter Kasting Committed by V8 LUCI CQ

Fix another -Wimplicit-int-float-conversion case.

Bug: chromium:989932
Change-Id: Ic56e0726ff45b679af8fbb06f2b00cae6126d8d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3003448Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75537}
parent 6f9b389b
...@@ -3219,42 +3219,22 @@ double Simulator::FPRoundInt(double value, FPRounding round_mode) { ...@@ -3219,42 +3219,22 @@ double Simulator::FPRoundInt(double value, FPRounding round_mode) {
int32_t Simulator::FPToInt32(double value, FPRounding rmode) { int32_t Simulator::FPToInt32(double value, FPRounding rmode) {
value = FPRoundInt(value, rmode); value = FPRoundInt(value, rmode);
if (value >= kWMaxInt) { return base::saturated_cast<int32_t>(value);
return kWMaxInt;
} else if (value < kWMinInt) {
return kWMinInt;
}
return std::isnan(value) ? 0 : static_cast<int32_t>(value);
} }
int64_t Simulator::FPToInt64(double value, FPRounding rmode) { int64_t Simulator::FPToInt64(double value, FPRounding rmode) {
value = FPRoundInt(value, rmode); value = FPRoundInt(value, rmode);
if (value >= kXMaxInt) { return base::saturated_cast<int64_t>(value);
return kXMaxInt;
} else if (value < kXMinInt) {
return kXMinInt;
}
return std::isnan(value) ? 0 : static_cast<int64_t>(value);
} }
uint32_t Simulator::FPToUInt32(double value, FPRounding rmode) { uint32_t Simulator::FPToUInt32(double value, FPRounding rmode) {
value = FPRoundInt(value, rmode); value = FPRoundInt(value, rmode);
if (value >= kWMaxUInt) { return base::saturated_cast<uint32_t>(value);
return kWMaxUInt;
} else if (value < 0.0) {
return 0;
}
return std::isnan(value) ? 0 : static_cast<uint32_t>(value);
} }
uint64_t Simulator::FPToUInt64(double value, FPRounding rmode) { uint64_t Simulator::FPToUInt64(double value, FPRounding rmode) {
value = FPRoundInt(value, rmode); value = FPRoundInt(value, rmode);
if (value >= kXMaxUInt) { return base::saturated_cast<uint64_t>(value);
return kXMaxUInt;
} else if (value < 0.0) {
return 0;
}
return std::isnan(value) ? 0 : static_cast<uint64_t>(value);
} }
#define DEFINE_NEON_FP_VECTOR_OP(FN, OP, PROCNAN) \ #define DEFINE_NEON_FP_VECTOR_OP(FN, OP, PROCNAN) \
......
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