LLVM API Documentation

IsInf.cpp

Go to the documentation of this file.
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 #include "llvm/System/IncludeFile.h"
00012 
00013 #if HAVE_ISINF_IN_MATH_H
00014 # include <math.h>
00015 #elif HAVE_ISINF_IN_CMATH
00016 # include <cmath>
00017 #elif HAVE_STD_ISINF_IN_CMATH
00018 # include <cmath>
00019 using std::isinf;
00020 #elif HAVE_FINITE_IN_IEEEFP_H
00021 // A handy workaround I found at http://www.unixguide.net/sun/faq ...
00022 // apparently this has been a problem with Solaris for years.
00023 # include <ieeefp.h>
00024 static int isinf(double x) { return !finite(x) && x==x; }
00025 #elif defined(_MSC_VER)
00026 #include <float.h>
00027 #define isinf(X) (!_finite(X))
00028 #elif defined(_AIX) && defined(__GNUC__)
00029 // GCC's fixincludes seems to be removing the isinf() declaration from the
00030 // system header /usr/include/math.h
00031 # include <math.h>
00032 static int isinf(double x) { return !finite(x) && x==x; }
00033 #elif defined(__hpux)
00034 // HP-UX is "special"
00035 #include <math.h>
00036 static int isinf(double x) { return ((x)==INFINITY)||((x)==-INFINITY); }
00037 #else
00038 # error "Don't know how to get isinf()"
00039 #endif
00040 
00041 namespace llvm {
00042 
00043 int IsInf (float f)  { return isinf (f); }
00044 int IsInf (double d) { return isinf (d); }
00045 
00046 } // end namespace llvm;
00047 
00048 DEFINING_FILE_FOR(SupportIsInf)