os/ossrv/ossrv_pub/boost_apis/boost/limits.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
sl@0
     2
//  (C) Copyright John maddock 1999. 
sl@0
     3
//  (C) David Abrahams 2002.  Distributed under the Boost
sl@0
     4
//  Software License, Version 1.0. (See accompanying file
sl@0
     5
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
sl@0
     6
//
sl@0
     7
// use this header as a workaround for missing <limits>
sl@0
     8
sl@0
     9
//  See http://www.boost.org/libs/utility/limits.html for documentation.
sl@0
    10
sl@0
    11
#ifndef BOOST_LIMITS
sl@0
    12
#define BOOST_LIMITS
sl@0
    13
sl@0
    14
#include <boost/config.hpp>
sl@0
    15
sl@0
    16
#ifdef BOOST_NO_LIMITS
sl@0
    17
# include <boost/detail/limits.hpp>
sl@0
    18
#else
sl@0
    19
# include <limits>
sl@0
    20
#endif
sl@0
    21
sl@0
    22
#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
sl@0
    23
      || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
sl@0
    24
// Add missing specializations for numeric_limits:
sl@0
    25
#ifdef BOOST_HAS_MS_INT64
sl@0
    26
#  define BOOST_LLT __int64
sl@0
    27
#  define BOOST_ULLT unsigned __int64
sl@0
    28
#else
sl@0
    29
#  define BOOST_LLT  ::boost::long_long_type
sl@0
    30
#  define BOOST_ULLT  ::boost::ulong_long_type
sl@0
    31
#endif
sl@0
    32
sl@0
    33
namespace std
sl@0
    34
{
sl@0
    35
  template<>
sl@0
    36
  class numeric_limits<BOOST_LLT> 
sl@0
    37
  {
sl@0
    38
   public:
sl@0
    39
sl@0
    40
      BOOST_STATIC_CONSTANT(bool, is_specialized = true);
sl@0
    41
#ifdef BOOST_HAS_MS_INT64
sl@0
    42
      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; }
sl@0
    43
      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; }
sl@0
    44
#elif defined(LLONG_MAX)
sl@0
    45
      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; }
sl@0
    46
      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; }
sl@0
    47
#elif defined(LONGLONG_MAX)
sl@0
    48
      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; }
sl@0
    49
      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; }
sl@0
    50
#else
sl@0
    51
      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
sl@0
    52
      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); }
sl@0
    53
#endif
sl@0
    54
      BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
sl@0
    55
      BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
sl@0
    56
      BOOST_STATIC_CONSTANT(bool, is_signed = true);
sl@0
    57
      BOOST_STATIC_CONSTANT(bool, is_integer = true);
sl@0
    58
      BOOST_STATIC_CONSTANT(bool, is_exact = true);
sl@0
    59
      BOOST_STATIC_CONSTANT(int, radix = 2);
sl@0
    60
      static BOOST_LLT epsilon() throw() { return 0; };
sl@0
    61
      static BOOST_LLT round_error() throw() { return 0; };
sl@0
    62
sl@0
    63
      BOOST_STATIC_CONSTANT(int, min_exponent = 0);
sl@0
    64
      BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
sl@0
    65
      BOOST_STATIC_CONSTANT(int, max_exponent = 0);
sl@0
    66
      BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
sl@0
    67
sl@0
    68
      BOOST_STATIC_CONSTANT(bool, has_infinity = false);
sl@0
    69
      BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
sl@0
    70
      BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
sl@0
    71
      BOOST_STATIC_CONSTANT(bool, has_denorm = false);
sl@0
    72
      BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
sl@0
    73
      static BOOST_LLT infinity() throw() { return 0; };
sl@0
    74
      static BOOST_LLT quiet_NaN() throw() { return 0; };
sl@0
    75
      static BOOST_LLT signaling_NaN() throw() { return 0; };
sl@0
    76
      static BOOST_LLT denorm_min() throw() { return 0; };
sl@0
    77
sl@0
    78
      BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
sl@0
    79
      BOOST_STATIC_CONSTANT(bool, is_bounded = false);
sl@0
    80
      BOOST_STATIC_CONSTANT(bool, is_modulo = false);
sl@0
    81
sl@0
    82
      BOOST_STATIC_CONSTANT(bool, traps = false);
sl@0
    83
      BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
sl@0
    84
      BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
sl@0
    85
      
sl@0
    86
  };
sl@0
    87
sl@0
    88
  template<>
sl@0
    89
  class numeric_limits<BOOST_ULLT> 
sl@0
    90
  {
sl@0
    91
   public:
sl@0
    92
sl@0
    93
      BOOST_STATIC_CONSTANT(bool, is_specialized = true);
sl@0
    94
#ifdef BOOST_HAS_MS_INT64
sl@0
    95
      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; }
sl@0
    96
      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; }
sl@0
    97
#elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
sl@0
    98
      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; }
sl@0
    99
      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; }
sl@0
   100
#elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN)
sl@0
   101
      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; }
sl@0
   102
      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; }
sl@0
   103
#else
sl@0
   104
      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; }
sl@0
   105
      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; }
sl@0
   106
#endif
sl@0
   107
      BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
sl@0
   108
      BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
sl@0
   109
      BOOST_STATIC_CONSTANT(bool, is_signed = false);
sl@0
   110
      BOOST_STATIC_CONSTANT(bool, is_integer = true);
sl@0
   111
      BOOST_STATIC_CONSTANT(bool, is_exact = true);
sl@0
   112
      BOOST_STATIC_CONSTANT(int, radix = 2);
sl@0
   113
      static BOOST_ULLT epsilon() throw() { return 0; };
sl@0
   114
      static BOOST_ULLT round_error() throw() { return 0; };
sl@0
   115
sl@0
   116
      BOOST_STATIC_CONSTANT(int, min_exponent = 0);
sl@0
   117
      BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
sl@0
   118
      BOOST_STATIC_CONSTANT(int, max_exponent = 0);
sl@0
   119
      BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
sl@0
   120
sl@0
   121
      BOOST_STATIC_CONSTANT(bool, has_infinity = false);
sl@0
   122
      BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
sl@0
   123
      BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
sl@0
   124
      BOOST_STATIC_CONSTANT(bool, has_denorm = false);
sl@0
   125
      BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
sl@0
   126
      static BOOST_ULLT infinity() throw() { return 0; };
sl@0
   127
      static BOOST_ULLT quiet_NaN() throw() { return 0; };
sl@0
   128
      static BOOST_ULLT signaling_NaN() throw() { return 0; };
sl@0
   129
      static BOOST_ULLT denorm_min() throw() { return 0; };
sl@0
   130
sl@0
   131
      BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
sl@0
   132
      BOOST_STATIC_CONSTANT(bool, is_bounded = false);
sl@0
   133
      BOOST_STATIC_CONSTANT(bool, is_modulo = false);
sl@0
   134
sl@0
   135
      BOOST_STATIC_CONSTANT(bool, traps = false);
sl@0
   136
      BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
sl@0
   137
      BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
sl@0
   138
      
sl@0
   139
  };
sl@0
   140
}
sl@0
   141
#endif 
sl@0
   142
sl@0
   143
#endif