From eb61d60e1b7f630be3cf86d01f00c604d40e5cea Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Tue, 7 Dec 2004 06:46:50 +0000 Subject: [PATCH] Fix check for valid floats. Also use and HUGE_VALF instead of std::numeric_limits, because they work in more platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18593 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Constants.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index c97d9fc8d39..dc64161ce07 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -21,7 +21,6 @@ #include "llvm/ADT/StringExtras.h" #include #include -#include 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::has_infinity && - std::numeric_limits::has_infinity && - Val == std::numeric_limits::infinity()) || - (std::numeric_limits::has_quiet_NaN && - std::numeric_limits::has_quiet_NaN && - Val == std::numeric_limits::quiet_NaN()) || - (Val >= -std::numeric_limits::max() && - Val <= std::numeric_limits::max()); + return isinf(Val) || isnan(Val) || (Val >= -HUGE_VALF && Val <= HUGE_VALF); case Type::DoubleTyID: return true; // This is the largest type... -- 2.34.1