cast: use is_nan to avoid integer warnings
This commit is contained in:
parent
6f4bc6d6b2
commit
d1fe677977
5
cast.hpp
5
cast.hpp
@ -88,10 +88,7 @@ trunc_cast (const SrcT src)
|
|||||||
{
|
{
|
||||||
auto dst = static_cast<DstT> (src);
|
auto dst = static_cast<DstT> (src);
|
||||||
|
|
||||||
// check if we're testing a NaN by using self-equality. this will not hold
|
if (!util::is_nan (src)) {
|
||||||
// for NaN, but makes specialisation easier given we don't need to special
|
|
||||||
// case for integers (which don't have std::isnan).
|
|
||||||
if (src == src) {
|
|
||||||
CHECK_EQ (static_cast<SrcT> (dst), src);
|
CHECK_EQ (static_cast<SrcT> (dst), src);
|
||||||
} else {
|
} else {
|
||||||
CHECK_NEQ (dst, dst);
|
CHECK_NEQ (dst, dst);
|
||||||
|
Loading…
Reference in New Issue
Block a user