• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // -*- C++ -*-
2 //===--------------------- support/win32/limits_win32.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_WIN32_LIMITS_WIN32_H
12 #define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
13 
14 #if !defined(_LIBCPP_MSVCRT)
15 #error "This header complements the Microsoft C Runtime library, and should not be included otherwise."
16 #else
17 
18 #include <limits.h> // CHAR_BIT
19 #include <float.h> // limit constants
20 
21 #if ! defined(__clang__)
22 #define __CHAR_BIT__       CHAR_BIT
23 
24 #define __FLT_MANT_DIG__   FLT_MANT_DIG
25 #define __FLT_DIG__        FLT_DIG
26 #define __FLT_RADIX__      FLT_RADIX
27 #define __FLT_MIN_EXP__    FLT_MIN_EXP
28 #define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
29 #define __FLT_MAX_EXP__    FLT_MAX_EXP
30 #define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
31 #define __FLT_MIN__        FLT_MIN
32 #define __FLT_MAX__        FLT_MAX
33 #define __FLT_EPSILON__    FLT_EPSILON
34 // predefined by MinGW GCC
35 #define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
36 
37 #define __DBL_MANT_DIG__   DBL_MANT_DIG
38 #define __DBL_DIG__        DBL_DIG
39 #define __DBL_RADIX__      DBL_RADIX
40 #define __DBL_MIN_EXP__    DBL_MIN_EXP
41 #define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
42 #define __DBL_MAX_EXP__    DBL_MAX_EXP
43 #define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
44 #define __DBL_MIN__        DBL_MIN
45 #define __DBL_MAX__        DBL_MAX
46 #define __DBL_EPSILON__    DBL_EPSILON
47 // predefined by MinGW GCC
48 #define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
49 
50 #define __LDBL_MANT_DIG__   LDBL_MANT_DIG
51 #define __LDBL_DIG__        LDBL_DIG
52 #define __LDBL_RADIX__      LDBL_RADIX
53 #define __LDBL_MIN_EXP__    LDBL_MIN_EXP
54 #define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
55 #define __LDBL_MAX_EXP__    LDBL_MAX_EXP
56 #define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
57 #define __LDBL_MIN__        LDBL_MIN
58 #define __LDBL_MAX__        LDBL_MAX
59 #define __LDBL_EPSILON__    LDBL_EPSILON
60 // predefined by MinGW GCC
61 #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
62 
63 // __builtin replacements/workarounds
64 #include <math.h> // HUGE_VAL
65 #include <ymath.h> // internal MSVC header providing the needed functionality
66 #define __builtin_huge_val()     HUGE_VAL
67 #define __builtin_huge_valf()    _FInf._Float
68 #define __builtin_huge_vall()    _LInf._Long_double
69 #define __builtin_nan(__dummy)   _Nan._Double
70 #define __builtin_nanf(__dummy)  _FNan._Float
71 #define __builtin_nanl(__dummmy) _LNan._Long_double
72 #define __builtin_nans(__dummy)  _Snan._Double
73 #define __builtin_nansf(__dummy) _FSnan._Float
74 #define __builtin_nansl(__dummy) _LSnan._Long_double
75 #endif // ! defined(__clang__)
76 
77 #endif // _LIBCPP_MSVCRT
78 
79 #endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
80