1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Fix check for valid floats. Also use and HUGE_VALF instead

of std::numeric_limits, because they work in more platforms.

llvm-svn: 18593
This commit is contained in:
Alkis Evlogimenos 2004-12-07 06:46:50 +00:00
parent 85a2e38a56
commit 3bcde892c3

View File

@ -21,7 +21,6 @@
#include "llvm/ADT/StringExtras.h"
#include <algorithm>
#include <iostream>
#include <limits>
using namespace llvm;
ConstantBool *ConstantBool::True = new ConstantBool(true);
@ -443,15 +442,7 @@ bool ConstantFP::isValueValidForType(const Type *Ty, double Val) {
// TODO: Figure out how to test if a double can be cast to a float!
case Type::FloatTyID:
return
(std::numeric_limits<double>::has_infinity &&
std::numeric_limits<float>::has_infinity &&
Val == std::numeric_limits<double>::infinity()) ||
(std::numeric_limits<double>::has_quiet_NaN &&
std::numeric_limits<float>::has_quiet_NaN &&
Val == std::numeric_limits<double>::quiet_NaN()) ||
(Val >= -std::numeric_limits<float>::max() &&
Val <= std::numeric_limits<float>::max());
return isinf(Val) || isnan(Val) || (Val >= -HUGE_VALF && Val <= HUGE_VALF);
case Type::DoubleTyID:
return true; // This is the largest type...