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