xref: /aosp_15_r20/external/llvm/lib/Support/MathExtras.cpp (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- MathExtras.cpp - Implement the MathExtras header --------------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file implements the MathExtras.h header
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #include "llvm/Support/MathExtras.h"
15*9880d681SAndroid Build Coastguard Worker 
16*9880d681SAndroid Build Coastguard Worker #ifdef _MSC_VER
17*9880d681SAndroid Build Coastguard Worker #include <limits>
18*9880d681SAndroid Build Coastguard Worker #else
19*9880d681SAndroid Build Coastguard Worker #include <math.h>
20*9880d681SAndroid Build Coastguard Worker #endif
21*9880d681SAndroid Build Coastguard Worker 
22*9880d681SAndroid Build Coastguard Worker namespace llvm {
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker #if defined(_MSC_VER)
25*9880d681SAndroid Build Coastguard Worker   // Visual Studio defines the HUGE_VAL class of macros using purposeful
26*9880d681SAndroid Build Coastguard Worker   // constant arithmetic overflow, which it then warns on when encountered.
27*9880d681SAndroid Build Coastguard Worker   const float huge_valf = std::numeric_limits<float>::infinity();
28*9880d681SAndroid Build Coastguard Worker #else
29*9880d681SAndroid Build Coastguard Worker   const float huge_valf = HUGE_VALF;
30*9880d681SAndroid Build Coastguard Worker #endif
31*9880d681SAndroid Build Coastguard Worker 
32*9880d681SAndroid Build Coastguard Worker }
33