Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/integer.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
40 // Helper templates ------------------------------------------------------// | 40 // Helper templates ------------------------------------------------------// |
41 | 41 |
42 // fast integers from least integers | 42 // fast integers from least integers |
43 // int_fast_t<> works correctly for unsigned too, in spite of the name. | 43 // int_fast_t<> works correctly for unsigned too, in spite of the name. |
44 template< typename LeastInt > | 44 template< typename LeastInt > |
45 struct int_fast_t | 45 struct int_fast_t |
46 { | 46 { |
47 typedef LeastInt fast; | 47 typedef LeastInt fast; |
48 typedef fast type; | 48 typedef fast type; |
49 }; // imps may specialize | 49 }; // imps may specialize |
50 | 50 |
51 namespace detail{ | 51 namespace detail{ |
52 | 52 |
53 // convert category to type | 53 // convert category to type |
54 template< int Category > struct int_least_helper {}; // default is empty | 54 template< int Category > struct int_least_helper {}; // default is empty |
55 template< int Category > struct uint_least_helper {}; // default is empty | 55 template< int Category > struct uint_least_helper {}; // default is empty |
56 | 56 |
57 // specializatons: 1=long, 2=int, 3=short, 4=signed char, | 57 // specializatons: 1=long, 2=int, 3=short, 4=signed char, |
58 // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char | 58 // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char |
89 #endif | 89 #endif |
90 #if UINT_MAX != USHRT_MAX | 90 #if UINT_MAX != USHRT_MAX |
91 template <> struct exact_signed_base_helper<sizeof(int)* CHAR_BIT> { typedef int exact; }; | 91 template <> struct exact_signed_base_helper<sizeof(int)* CHAR_BIT> { typedef int exact; }; |
92 template <> struct exact_unsigned_base_helper<sizeof(unsigned int)* CHAR_BIT> { typedef unsigned int exact; }; | 92 template <> struct exact_unsigned_base_helper<sizeof(unsigned int)* CHAR_BIT> { typedef unsigned int exact; }; |
93 #endif | 93 #endif |
94 #if ULONG_MAX != UINT_MAX | 94 #if ULONG_MAX != UINT_MAX && ( !defined __TI_COMPILER_VERSION__ || \ |
95 ( __TI_COMPILER_VERSION__ >= 7000000 && !defined __TI_40BIT_LONG__ ) ) | |
95 template <> struct exact_signed_base_helper<sizeof(long)* CHAR_BIT> { typedef long exact; }; | 96 template <> struct exact_signed_base_helper<sizeof(long)* CHAR_BIT> { typedef long exact; }; |
96 template <> struct exact_unsigned_base_helper<sizeof(unsigned long)* CHAR_BIT> { typedef unsigned long exact; }; | 97 template <> struct exact_unsigned_base_helper<sizeof(unsigned long)* CHAR_BIT> { typedef unsigned long exact; }; |
97 #endif | 98 #endif |
98 #if defined(BOOST_HAS_LONG_LONG) &&\ | 99 #if defined(BOOST_HAS_LONG_LONG) &&\ |
99 ((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\ | 100 ((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\ |
109 | 110 |
110 // integer templates specifying number of bits ---------------------------// | 111 // integer templates specifying number of bits ---------------------------// |
111 | 112 |
112 // signed | 113 // signed |
113 template< int Bits > // bits (including sign) required | 114 template< int Bits > // bits (including sign) required |
114 struct int_t : public detail::exact_signed_base_helper<Bits> | 115 struct int_t : public boost::detail::exact_signed_base_helper<Bits> |
115 { | 116 { |
116 BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), | 117 BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), |
117 "No suitable signed integer type with the requested number of bits is available."); | 118 "No suitable signed integer type with the requested number of bits is available."); |
118 typedef typename detail::int_least_helper | 119 typedef typename boost::detail::int_least_helper |
119 < | 120 < |
120 #ifdef BOOST_HAS_LONG_LONG | 121 #ifdef BOOST_HAS_LONG_LONG |
121 (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + | 122 (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + |
122 #else | 123 #else |
123 1 + | 124 1 + |
130 typedef typename int_fast_t<least>::type fast; | 131 typedef typename int_fast_t<least>::type fast; |
131 }; | 132 }; |
132 | 133 |
133 // unsigned | 134 // unsigned |
134 template< int Bits > // bits required | 135 template< int Bits > // bits required |
135 struct uint_t : public detail::exact_unsigned_base_helper<Bits> | 136 struct uint_t : public boost::detail::exact_unsigned_base_helper<Bits> |
136 { | 137 { |
137 BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), | 138 BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), |
138 "No suitable unsigned integer type with the requested number of bits is available."); | 139 "No suitable unsigned integer type with the requested number of bits is available."); |
139 #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) | 140 #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) |
140 // It's really not clear why this workaround should be needed... shrug I guess! JM | 141 // It's really not clear why this workaround should be needed... shrug I guess! JM |
141 BOOST_STATIC_CONSTANT(int, s = | 142 BOOST_STATIC_CONSTANT(int, s = |
142 6 + | 143 6 + |
143 (Bits <= ::std::numeric_limits<unsigned long>::digits) + | 144 (Bits <= ::std::numeric_limits<unsigned long>::digits) + |
144 (Bits <= ::std::numeric_limits<unsigned int>::digits) + | 145 (Bits <= ::std::numeric_limits<unsigned int>::digits) + |
145 (Bits <= ::std::numeric_limits<unsigned short>::digits) + | 146 (Bits <= ::std::numeric_limits<unsigned short>::digits) + |
146 (Bits <= ::std::numeric_limits<unsigned char>::digits)); | 147 (Bits <= ::std::numeric_limits<unsigned char>::digits)); |
147 typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least; | 148 typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least; |
148 #else | 149 #else |
149 typedef typename detail::uint_least_helper | 150 typedef typename boost::detail::uint_least_helper |
150 < | 151 < |
151 #ifdef BOOST_HAS_LONG_LONG | 152 #ifdef BOOST_HAS_LONG_LONG |
152 (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + | 153 (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + |
153 #else | 154 #else |
154 1 + | 155 1 + |
155 #endif | 156 #endif |
164 }; | 165 }; |
165 | 166 |
166 // integer templates specifying extreme value ----------------------------// | 167 // integer templates specifying extreme value ----------------------------// |
167 | 168 |
168 // signed | 169 // signed |
169 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) | 170 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) |
170 template< boost::long_long_type MaxValue > // maximum value to require support | 171 template< boost::long_long_type MaxValue > // maximum value to require support |
171 #else | 172 #else |
172 template< long MaxValue > // maximum value to require support | 173 template< long MaxValue > // maximum value to require support |
173 #endif | 174 #endif |
174 struct int_max_value_t | 175 struct int_max_value_t |
175 { | 176 { |
176 typedef typename detail::int_least_helper | 177 typedef typename boost::detail::int_least_helper |
177 < | 178 < |
178 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) | 179 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) |
179 (MaxValue <= ::boost::integer_traits<boost::long_long_type>::const_max) + | 180 (MaxValue <= ::boost::integer_traits<boost::long_long_type>::const_max) + |
180 #else | 181 #else |
181 1 + | 182 1 + |
182 #endif | 183 #endif |
183 (MaxValue <= ::boost::integer_traits<long>::const_max) + | 184 (MaxValue <= ::boost::integer_traits<long>::const_max) + |
186 (MaxValue <= ::boost::integer_traits<signed char>::const_max) | 187 (MaxValue <= ::boost::integer_traits<signed char>::const_max) |
187 >::least least; | 188 >::least least; |
188 typedef typename int_fast_t<least>::type fast; | 189 typedef typename int_fast_t<least>::type fast; |
189 }; | 190 }; |
190 | 191 |
191 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) | 192 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) |
192 template< boost::long_long_type MinValue > // minimum value to require support | 193 template< boost::long_long_type MinValue > // minimum value to require support |
193 #else | 194 #else |
194 template< long MinValue > // minimum value to require support | 195 template< long MinValue > // minimum value to require support |
195 #endif | 196 #endif |
196 struct int_min_value_t | 197 struct int_min_value_t |
197 { | 198 { |
198 typedef typename detail::int_least_helper | 199 typedef typename boost::detail::int_least_helper |
199 < | 200 < |
200 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) | 201 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) |
201 (MinValue >= ::boost::integer_traits<boost::long_long_type>::const_min) + | 202 (MinValue >= ::boost::integer_traits<boost::long_long_type>::const_min) + |
202 #else | 203 #else |
203 1 + | 204 1 + |
204 #endif | 205 #endif |
205 (MinValue >= ::boost::integer_traits<long>::const_min) + | 206 (MinValue >= ::boost::integer_traits<long>::const_min) + |
214 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) | 215 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) |
215 template< boost::ulong_long_type MaxValue > // minimum value to require support | 216 template< boost::ulong_long_type MaxValue > // minimum value to require support |
216 #else | 217 #else |
217 template< unsigned long MaxValue > // minimum value to require support | 218 template< unsigned long MaxValue > // minimum value to require support |
218 #endif | 219 #endif |
219 struct uint_value_t | 220 struct uint_value_t |
220 { | 221 { |
221 #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) | 222 #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) |
222 // It's really not clear why this workaround should be needed... shrug I guess! JM | 223 // It's really not clear why this workaround should be needed... shrug I guess! JM |
223 #if defined(BOOST_NO_INTEGRAL_INT64_T) | 224 #if defined(BOOST_NO_INTEGRAL_INT64_T) |
224 BOOST_STATIC_CONSTANT(unsigned, which = | 225 BOOST_STATIC_CONSTANT(unsigned, which = |
225 1 + | 226 1 + |
226 (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + | 227 (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + |
227 (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + | 228 (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + |
228 (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + | 229 (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + |
229 (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)); | 230 (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)); |
230 typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; | 231 typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; |
231 #else // BOOST_NO_INTEGRAL_INT64_T | 232 #else // BOOST_NO_INTEGRAL_INT64_T |
232 BOOST_STATIC_CONSTANT(unsigned, which = | 233 BOOST_STATIC_CONSTANT(unsigned, which = |
233 1 + | 234 1 + |
234 (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + | 235 (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + |
235 (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + | 236 (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + |
236 (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + | 237 (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + |
237 (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + | 238 (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + |
238 (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)); | 239 (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)); |
239 typedef typename detail::uint_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; | 240 typedef typename detail::uint_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; |
240 #endif // BOOST_NO_INTEGRAL_INT64_T | 241 #endif // BOOST_NO_INTEGRAL_INT64_T |
241 #else | 242 #else |
242 typedef typename detail::uint_least_helper | 243 typedef typename boost::detail::uint_least_helper |
243 < | 244 < |
244 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) | 245 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) |
245 (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + | 246 (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + |
246 #else | 247 #else |
247 1 + | 248 1 + |
248 #endif | 249 #endif |