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