]> git.lyx.org Git - lyx.git/blob - boost/boost/limits.hpp
boost::filesystem added
[lyx.git] / boost / boost / limits.hpp
1
2 //  (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
3 //  distribute this software is granted provided this copyright notice appears
4 //  in all copies. This software is provided "as is" without express or implied
5 //  warranty, and with no claim as to its suitability for any purpose.
6 //
7 // use this header as a workaround for missing <limits>
8
9 //  See http://www.boost.org/libs/utility/limits.html for documentation.
10
11 #ifndef BOOST_LIMITS
12 #define BOOST_LIMITS
13
14 #include <boost/config.hpp>
15
16 #ifdef BOOST_NO_LIMITS
17 # include <boost/detail/limits.hpp>
18 #else
19 # include <limits>
20 #endif
21
22 #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
23       || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
24 // Add missing specializations for numeric_limits:
25 #ifdef BOOST_HAS_MS_INT64
26 #  define BOOST_LLT __int64
27 #else
28 #  define BOOST_LLT long long
29 #endif
30
31 namespace std
32 {
33   template<>
34   class numeric_limits<BOOST_LLT> 
35   {
36    public:
37
38       BOOST_STATIC_CONSTANT(bool, is_specialized = true);
39 #ifdef BOOST_HAS_MS_INT64
40       static BOOST_LLT min(){ return 0x8000000000000000i64; }
41       static BOOST_LLT max(){ return 0x7FFFFFFFFFFFFFFFi64; }
42 #elif defined(LLONG_MAX)
43       static BOOST_LLT min(){ return LLONG_MIN; }
44       static BOOST_LLT max(){ return LLONG_MAX; }
45 #elif defined(LONGLONG_MAX)
46       static BOOST_LLT min(){ return LONGLONG_MIN; }
47       static BOOST_LLT max(){ return LONGLONG_MAX; }
48 #else
49       static BOOST_LLT min(){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
50       static BOOST_LLT max(){ return ~min(); }
51 #endif
52       BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
53       BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
54       BOOST_STATIC_CONSTANT(bool, is_signed = true);
55       BOOST_STATIC_CONSTANT(bool, is_integer = true);
56       BOOST_STATIC_CONSTANT(bool, is_exact = true);
57       BOOST_STATIC_CONSTANT(int, radix = 2);
58       static BOOST_LLT epsilon() throw() { return 0; };
59       static BOOST_LLT round_error() throw() { return 0; };
60
61       BOOST_STATIC_CONSTANT(int, min_exponent = 0);
62       BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
63       BOOST_STATIC_CONSTANT(int, max_exponent = 0);
64       BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
65
66       BOOST_STATIC_CONSTANT(bool, has_infinity = false);
67       BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
68       BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
69       BOOST_STATIC_CONSTANT(bool, has_denorm = false);
70       BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
71       static BOOST_LLT infinity() throw() { return 0; };
72       static BOOST_LLT quiet_NaN() throw() { return 0; };
73       static BOOST_LLT signaling_NaN() throw() { return 0; };
74       static BOOST_LLT denorm_min() throw() { return 0; };
75
76       BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
77       BOOST_STATIC_CONSTANT(bool, is_bounded = false);
78       BOOST_STATIC_CONSTANT(bool, is_modulo = false);
79
80       BOOST_STATIC_CONSTANT(bool, traps = false);
81       BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
82       BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
83       
84   };
85
86   template<>
87   class numeric_limits<unsigned BOOST_LLT> 
88   {
89    public:
90
91       BOOST_STATIC_CONSTANT(bool, is_specialized = true);
92 #ifdef BOOST_HAS_MS_INT64
93       static unsigned BOOST_LLT min(){ return 0ui64; }
94       static unsigned BOOST_LLT max(){ return 0xFFFFFFFFFFFFFFFFui64; }
95 #elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
96       static unsigned BOOST_LLT min(){ return ULLONG_MIN; }
97       static unsigned BOOST_LLT max(){ return ULLONG_MAX; }
98 #elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN)
99       static unsigned BOOST_LLT min(){ return ULONGLONG_MIN; }
100       static unsigned BOOST_LLT max(){ return ULONGLONG_MAX; }
101 #else
102       static unsigned BOOST_LLT min(){ return 0uLL; }
103       static unsigned BOOST_LLT max(){ return ~0uLL; }
104 #endif
105       BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
106       BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
107       BOOST_STATIC_CONSTANT(bool, is_signed = false);
108       BOOST_STATIC_CONSTANT(bool, is_integer = true);
109       BOOST_STATIC_CONSTANT(bool, is_exact = true);
110       BOOST_STATIC_CONSTANT(int, radix = 2);
111       static unsigned BOOST_LLT epsilon() throw() { return 0; };
112       static unsigned BOOST_LLT round_error() throw() { return 0; };
113
114       BOOST_STATIC_CONSTANT(int, min_exponent = 0);
115       BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
116       BOOST_STATIC_CONSTANT(int, max_exponent = 0);
117       BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
118
119       BOOST_STATIC_CONSTANT(bool, has_infinity = false);
120       BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
121       BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
122       BOOST_STATIC_CONSTANT(bool, has_denorm = false);
123       BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
124       static unsigned BOOST_LLT infinity() throw() { return 0; };
125       static unsigned BOOST_LLT quiet_NaN() throw() { return 0; };
126       static unsigned BOOST_LLT signaling_NaN() throw() { return 0; };
127       static unsigned BOOST_LLT denorm_min() throw() { return 0; };
128
129       BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
130       BOOST_STATIC_CONSTANT(bool, is_bounded = false);
131       BOOST_STATIC_CONSTANT(bool, is_modulo = false);
132
133       BOOST_STATIC_CONSTANT(bool, traps = false);
134       BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
135       BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
136       
137   };
138 }
139 #endif 
140
141 #endif