limits_win32.h 2.8 KB

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