summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-12-07 06:46:50 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-12-07 06:46:50 +0000
commit2b918420921d16a90b4e0c6ffe883695b3e64d2a (patch)
tree197ee17e9d0518e6de1e17a97bc5d1258b83bcee /llvm
parent784a0dcbd0b78d25b0ecd97d0b9edc5ca4f5a5e9 (diff)
downloadbcm5719-llvm-2b918420921d16a90b4e0c6ffe883695b3e64d2a.tar.gz
bcm5719-llvm-2b918420921d16a90b4e0c6ffe883695b3e64d2a.zip
Fix check for valid floats. Also use and HUGE_VALF instead
of std::numeric_limits, because they work in more platforms. llvm-svn: 18593
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/Constants.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index c97d9fc8d39..dc64161ce07 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/lib/VMCore/Constants.cpp
@@ -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...
OpenPOWER on IntegriCloud