mastodonpp  0.0.0
limits.h
1 // -*- C++ -*-
2 //===--------------------- support/ibm/limits.h ---------------------------===//
3 //
4 // The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
12 #define _LIBCPP_SUPPORT_IBM_LIMITS_H
13 
14 #if !defined(_AIX) // Linux
15 #include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
16 
17 static const unsigned int _QNAN_F = 0x7fc00000;
18 #define NANF (*((float *)(&_QNAN_F)))
19 static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
20 #define NANL (*((long double *)(&_QNAN_LDBL128)))
21 static const unsigned int _SNAN_F= 0x7f855555;
22 #define NANSF (*((float *)(&_SNAN_F)))
23 static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
24 #define NANS (*((double *)(&_SNAN_D)))
25 static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
26 #define NANSL (*((long double *)(&_SNAN_LDBL128)))
27 
28 #define __builtin_huge_val() HUGE_VAL
29 #define __builtin_huge_valf() HUGE_VALF
30 #define __builtin_huge_vall() HUGE_VALL
31 #define __builtin_nan(__dummy) NAN
32 #define __builtin_nanf(__dummy) NANF
33 #define __builtin_nanl(__dummy) NANL
34 #define __builtin_nans(__dummy) NANS
35 #define __builtin_nansf(__dummy) NANSF
36 #define __builtin_nansl(__dummy) NANSL
37 
38 #else
39 
40 #include <math.h>
41 #include <float.h> // limit constants
42 
43 #define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
44 #define __builtin_huge_valf() HUGE_VALF //0x7f800000
45 #define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
46 #define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
47 #define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
48 #define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
49 #define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
50 #define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
51 #define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
52 
53 #define __FLT_MANT_DIG__ FLT_MANT_DIG
54 #define __FLT_DIG__ FLT_DIG
55 #define __FLT_RADIX__ FLT_RADIX
56 #define __FLT_MIN_EXP__ FLT_MIN_EXP
57 #define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
58 #define __FLT_MAX_EXP__ FLT_MAX_EXP
59 #define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
60 #define __FLT_MIN__ FLT_MIN
61 #define __FLT_MAX__ FLT_MAX
62 #define __FLT_EPSILON__ FLT_EPSILON
63 // predefined by XLC on LoP
64 #define __FLT_DENORM_MIN__ 1.40129846e-45F
65 
66 #define __DBL_MANT_DIG__ DBL_MANT_DIG
67 #define __DBL_DIG__ DBL_DIG
68 #define __DBL_MIN_EXP__ DBL_MIN_EXP
69 #define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
70 #define __DBL_MAX_EXP__ DBL_MAX_EXP
71 #define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
72 #define __DBL_MIN__ DBL_MIN
73 #define __DBL_MAX__ DBL_MAX
74 #define __DBL_EPSILON__ DBL_EPSILON
75 // predefined by XLC on LoP
76 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
77 
78 #define __LDBL_MANT_DIG__ LDBL_MANT_DIG
79 #define __LDBL_DIG__ LDBL_DIG
80 #define __LDBL_MIN_EXP__ LDBL_MIN_EXP
81 #define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
82 #define __LDBL_MAX_EXP__ LDBL_MAX_EXP
83 #define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
84 #define __LDBL_MIN__ LDBL_MIN
85 #define __LDBL_MAX__ LDBL_MAX
86 #define __LDBL_EPSILON__ LDBL_EPSILON
87 // predefined by XLC on LoP
88 #if __LONGDOUBLE128
89 #define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
90 #else
91 #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
92 #endif
93 
94 // predefined by XLC on LoP
95 #define __CHAR_BIT__ 8
96 
97 #endif // _AIX
98 
99 #endif // _LIBCPP_SUPPORT_IBM_LIMITS_H