LLVM API Documentation
00001 //===-- IsInf.cpp - Platform-independent wrapper around C99 isinf() -------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // Platform-independent wrapper around C99 isinf() 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "llvm/Config/config.h" 00015 00016 #if HAVE_ISINF_IN_MATH_H 00017 # include <math.h> 00018 #elif HAVE_ISINF_IN_CMATH 00019 # include <cmath> 00020 #elif HAVE_STD_ISINF_IN_CMATH 00021 # include <cmath> 00022 using std::isinf; 00023 #elif HAVE_FINITE_IN_IEEEFP_H 00024 // A handy workaround I found at http://www.unixguide.net/sun/faq ... 00025 // apparently this has been a problem with Solaris for years. 00026 # include <ieeefp.h> 00027 static int isinf(double x) { return !finite(x) && x==x; } 00028 #elif defined(_MSC_VER) 00029 #include <float.h> 00030 #define isinf(X) (!_finite(X)) 00031 #elif defined(_AIX) && defined(__GNUC__) 00032 // GCC's fixincludes seems to be removing the isinf() declaration from the 00033 // system header /usr/include/math.h 00034 # include <math.h> 00035 static int isinf(double x) { return !finite(x) && x==x; } 00036 #elif defined(__hpux) 00037 // HP-UX is "special" 00038 #include <math.h> 00039 static int isinf(double x) { return ((x) == INFINITY) || ((x) == -INFINITY); } 00040 #else 00041 # error "Don't know how to get isinf()" 00042 #endif 00043 00044 namespace llvm { 00045 00046 int IsInf(float f) { return isinf(f); } 00047 int IsInf(double d) { return isinf(d); } 00048 00049 } // end namespace llvm;