Commit 8c1b2623 authored by asaka's avatar asaka Committed by Commit bot

Replace std::trunc() with trunc() to support cross-compiling

Fix-up of https://codereview.chromium.org/1965443003 required for
certain toolchains that do not support std::trunc().

BUG=

Review-Url: https://codereview.chromium.org/2056693002
Cr-Commit-Position: refs/heads/master@{#36882}
parent 2890137b
......@@ -26,7 +26,7 @@ static bool CanCast(F from) {
// A float can't represent 2^31 - 1 or 2^32 - 1 exactly, so promote the limits
// to double. Otherwise, the limit is truncated and numbers like 2^31 or 2^32
// get through, causing any static_cast to be undefined.
from = std::trunc(from);
from = trunc(from);
return from >= static_cast<double>(std::numeric_limits<T>::min()) &&
from <= static_cast<double>(std::numeric_limits<T>::max());
}
......
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