31#ifndef ETL_INTEGRAL_LIMITS_INCLUDED
32#define ETL_INTEGRAL_LIMITS_INCLUDED
49 #define LLONG_MAX 9223372036854775807LL
53 #define LLONG_MIN (-LLONG_MAX - 1LL)
57 #define ULLONG_MAX 18446744073709551615ULL
62 namespace private_integral_limits
75 template <
typename T =
void>
78 typedef signed char value_type;
80 static ETL_CONSTANT
signed char min = SCHAR_MIN;
81 static ETL_CONSTANT
signed char max = SCHAR_MAX;
82 static ETL_CONSTANT
int bits = CHAR_BIT;
83 static ETL_CONSTANT
bool is_signed = etl::is_signed<signed char>::value;
87 ETL_CONSTANT
signed char statics_signed_char<T>::min;
90 ETL_CONSTANT
signed char statics_signed_char<T>::max;
93 ETL_CONSTANT
int statics_signed_char<T>::bits;
96 ETL_CONSTANT
bool statics_signed_char<T>::is_signed;
100 template <
typename T =
void>
103 typedef unsigned char value_type;
105 static ETL_CONSTANT
unsigned char min = 0;
106 static ETL_CONSTANT
unsigned char max = UCHAR_MAX;
107 static ETL_CONSTANT
int bits = CHAR_BIT;
108 static ETL_CONSTANT
bool is_signed = etl::is_signed<unsigned char>::value;
111 template <
typename T>
112 ETL_CONSTANT
unsigned char statics_unsigned_char<T>::min;
114 template <
typename T>
115 ETL_CONSTANT
unsigned char statics_unsigned_char<T>::max;
117 template <
typename T>
118 ETL_CONSTANT
int statics_unsigned_char<T>::bits;
120 template <
typename T>
121 ETL_CONSTANT
bool statics_unsigned_char<T>::is_signed;
125 template <
typename T =
void>
128 typedef char value_type;
130 static ETL_CONSTANT
char min = (etl::is_signed<char>::value) ? SCHAR_MIN : 0;
131 static ETL_CONSTANT
char max = (etl::is_signed<char>::value) ? SCHAR_MAX :
static_cast<char>(UCHAR_MAX);
132 static ETL_CONSTANT
int bits = CHAR_BIT;
133 static ETL_CONSTANT
bool is_signed = etl::is_signed<char>::value;
136 template <
typename T>
137 ETL_CONSTANT
char statics_char<T>::min;
139 template <
typename T>
140 ETL_CONSTANT
char statics_char<T>::max;
142 template <
typename T>
143 ETL_CONSTANT
int statics_char<T>::bits;
145 template <
typename T>
146 ETL_CONSTANT
bool statics_char<T>::is_signed;
150 template <
typename T =
void>
153 typedef wchar_t value_type;
155 static ETL_CONSTANT
wchar_t min = WCHAR_MIN;
156 static ETL_CONSTANT
wchar_t max = WCHAR_MAX;
157 static ETL_CONSTANT
int bits = CHAR_BIT *
sizeof(wchar_t);
158 static ETL_CONSTANT
bool is_signed = etl::is_signed<wchar_t>::value;
161 template <
typename T>
162 ETL_CONSTANT
wchar_t statics_wchar_t<T>::min;
164 template <
typename T>
165 ETL_CONSTANT
wchar_t statics_wchar_t<T>::max;
167 template <
typename T>
168 ETL_CONSTANT
int statics_wchar_t<T>::bits;
170 template <
typename T>
171 ETL_CONSTANT
bool statics_wchar_t<T>::is_signed;
175#if defined(ETL_COMPILER_MICROSOFT)
176 #pragma warning(push)
177 #pragma warning(disable : 4309)
180 template <
typename T =
void>
183 typedef short value_type;
185 static ETL_CONSTANT
short min = SHRT_MIN;
186 static ETL_CONSTANT
short max = SHRT_MAX;
187 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(short) /
sizeof(char));
188 static ETL_CONSTANT
bool is_signed = etl::is_signed<short>::value;
191 template <
typename T>
192 ETL_CONSTANT
short statics_short<T>::min;
194 template <
typename T>
195 ETL_CONSTANT
short statics_short<T>::max;
197 template <
typename T>
198 ETL_CONSTANT
int statics_short<T>::bits;
200 template <
typename T>
201 ETL_CONSTANT
bool statics_short<T>::is_signed;
203#if defined(ETL_COMPILER_MICROSOFT)
209 template <
typename T =
void>
212 typedef unsigned short value_type;
214 static ETL_CONSTANT
unsigned short min = 0;
215 static ETL_CONSTANT
unsigned short max = USHRT_MAX;
216 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(
unsigned short) /
sizeof(char));
217 static ETL_CONSTANT
bool is_signed = etl::is_signed<unsigned short>::value;
220 template <
typename T>
221 ETL_CONSTANT
unsigned short statics_unsigned_short<T>::min;
223 template <
typename T>
224 ETL_CONSTANT
unsigned short statics_unsigned_short<T>::max;
226 template <
typename T>
227 ETL_CONSTANT
int statics_unsigned_short<T>::bits;
229 template <
typename T>
230 ETL_CONSTANT
bool statics_unsigned_short<T>::is_signed;
234 template <
typename T =
void>
237 typedef int value_type;
239 static ETL_CONSTANT
int min = INT_MIN;
240 static ETL_CONSTANT
int max = INT_MAX;
241 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(int) /
sizeof(char));
242 static ETL_CONSTANT
bool is_signed = etl::is_signed<int>::value;
245 template <
typename T>
246 ETL_CONSTANT
int statics_int<T>::min;
248 template <
typename T>
249 ETL_CONSTANT
int statics_int<T>::max;
251 template <
typename T>
252 ETL_CONSTANT
int statics_int<T>::bits;
254 template <
typename T>
255 ETL_CONSTANT
bool statics_int<T>::is_signed;
259 template <
typename T =
void>
262 typedef unsigned int value_type;
264 static ETL_CONSTANT
unsigned int min = 0;
265 static ETL_CONSTANT
unsigned int max = UINT_MAX;
266 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(
unsigned int) /
sizeof(char));
267 static ETL_CONSTANT
bool is_signed = etl::is_signed<unsigned int>::value;
270 template <
typename T>
271 ETL_CONSTANT
unsigned int statics_unsigned_int<T>::min;
273 template <
typename T>
274 ETL_CONSTANT
unsigned int statics_unsigned_int<T>::max;
276 template <
typename T>
277 ETL_CONSTANT
int statics_unsigned_int<T>::bits;
279 template <
typename T>
280 ETL_CONSTANT
bool statics_unsigned_int<T>::is_signed;
284 template <
typename T =
void>
287 typedef long value_type;
289 static ETL_CONSTANT
long min = LONG_MIN;
290 static ETL_CONSTANT
long max = LONG_MAX;
291 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(long) /
sizeof(char));
292 static ETL_CONSTANT
bool is_signed = etl::is_signed<long>::value;
295 template <
typename T>
296 ETL_CONSTANT
long statics_long<T>::min;
298 template <
typename T>
299 ETL_CONSTANT
long statics_long<T>::max;
301 template <
typename T>
302 ETL_CONSTANT
int statics_long<T>::bits;
304 template <
typename T>
305 ETL_CONSTANT
bool statics_long<T>::is_signed;
309 template <
typename T =
void>
312 typedef unsigned long value_type;
314 static ETL_CONSTANT
unsigned long min = 0;
315 static ETL_CONSTANT
unsigned long max = ULONG_MAX;
316 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(
unsigned long) /
sizeof(char));
317 static ETL_CONSTANT
bool is_signed = etl::is_signed<unsigned long>::value;
320 template <
typename T>
321 ETL_CONSTANT
unsigned long statics_unsigned_long<T>::min;
323 template <
typename T>
324 ETL_CONSTANT
unsigned long statics_unsigned_long<T>::max;
326 template <
typename T>
327 ETL_CONSTANT
int statics_unsigned_long<T>::bits;
329 template <
typename T>
330 ETL_CONSTANT
bool statics_unsigned_long<T>::is_signed;
334 template <
typename T =
void>
337 typedef long long value_type;
339 static ETL_CONSTANT
long long min = LLONG_MIN;
340 static ETL_CONSTANT
long long max = LLONG_MAX;
341 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(
long long) /
sizeof(char));
342 static ETL_CONSTANT
bool is_signed = etl::is_signed<long long>::value;
345 template <
typename T>
346 ETL_CONSTANT
long long statics_long_long<T>::min;
348 template <
typename T>
349 ETL_CONSTANT
long long statics_long_long<T>::max;
351 template <
typename T>
352 ETL_CONSTANT
int statics_long_long<T>::bits;
354 template <
typename T>
355 ETL_CONSTANT
bool statics_long_long<T>::is_signed;
359 template <
typename T =
void>
362 typedef unsigned long value_type;
364 static ETL_CONSTANT
unsigned long long min = 0;
365 static ETL_CONSTANT
unsigned long long max = ULLONG_MAX;
366 static ETL_CONSTANT
int bits = CHAR_BIT * (
sizeof(
unsigned long long) /
sizeof(char));
367 static ETL_CONSTANT
bool is_signed = etl::is_signed<unsigned long long>::value;
370 template <
typename T>
371 ETL_CONSTANT
unsigned long long statics_unsigned_long_long<T>::min;
373 template <
typename T>
374 ETL_CONSTANT
unsigned long long statics_unsigned_long_long<T>::max;
376 template <
typename T>
377 ETL_CONSTANT
int statics_unsigned_long_long<T>::bits;
379 template <
typename T>
380 ETL_CONSTANT
bool statics_unsigned_long_long<T>::is_signed;
382#if ETL_HAS_NATIVE_CHAR8_T
385 template <
typename T =
void>
386 struct statics_char8_t
390 static ETL_CONSTANT
char8_t min = (etl::is_signed<char8_t>::value) ? SCHAR_MIN : 0;
391 static ETL_CONSTANT
char8_t max = (etl::is_signed<char8_t>::value) ? SCHAR_MAX : static_cast<char8_t>(UCHAR_MAX);
392 static ETL_CONSTANT
int bits = CHAR_BIT;
393 static ETL_CONSTANT
bool is_signed = etl::is_signed<char8_t>::value;
396 template <
typename T>
397 ETL_CONSTANT
char8_t statics_char8_t<T>::min;
399 template <
typename T>
400 ETL_CONSTANT
char8_t statics_char8_t<T>::max;
402 template <
typename T>
403 ETL_CONSTANT
int statics_char8_t<T>::bits;
405 template <
typename T>
406 ETL_CONSTANT
bool statics_char8_t<T>::is_signed;
409#if ETL_HAS_NATIVE_CHAR16_T
412 template <
typename T =
void>
413 struct statics_char16_t
417 static ETL_CONSTANT
char16_t min = 0;
418 static ETL_CONSTANT
char16_t max = 0xFFFFU;
419 static ETL_CONSTANT
int bits = 16;
420 static ETL_CONSTANT
bool is_signed =
false;
423 template <
typename T>
424 ETL_CONSTANT
char16_t statics_char16_t<T>::min;
426 template <
typename T>
427 ETL_CONSTANT
char16_t statics_char16_t<T>::max;
429 template <
typename T>
430 ETL_CONSTANT
int statics_char16_t<T>::bits;
432 template <
typename T>
433 ETL_CONSTANT
bool statics_char16_t<T>::is_signed;
436#if ETL_HAS_NATIVE_CHAR32_T
439 template <
typename T =
void>
440 struct statics_char32_t
442 typedef char32_t value_type;
444 static ETL_CONSTANT
char32_t min = 0;
445 static ETL_CONSTANT
char32_t max = 0xFFFFFFFFU;
446 static ETL_CONSTANT
int bits = 32;
447 static ETL_CONSTANT
bool is_signed =
false;
450 template <
typename T>
451 ETL_CONSTANT
char32_t statics_char32_t<T>::min;
453 template <
typename T>
454 ETL_CONSTANT
char32_t statics_char32_t<T>::max;
456 template <
typename T>
457 ETL_CONSTANT
int statics_char32_t<T>::bits;
459 template <
typename T>
460 ETL_CONSTANT
bool statics_char32_t<T>::is_signed;
463#if ETL_USING_20BIT_TYPES
464template <
typename T =
void>
465 struct statics___int20
467 typedef __int20 value_type;
469 static ETL_CONSTANT __int20 min = 0x80000;
470 static ETL_CONSTANT __int20 max = 0x7FFFF;
471 static ETL_CONSTANT
int bits = 20;
472 static ETL_CONSTANT
bool is_signed =
true;
475 template <
typename T>
476 ETL_CONSTANT __int20 statics___int20<T>::min;
478 template <
typename T>
479 ETL_CONSTANT __int20 statics___int20<T>::max;
481 template <
typename T>
482 ETL_CONSTANT
int statics___int20<T>::bits;
484 template <
typename T>
485 ETL_CONSTANT
bool statics___int20<T>::is_signed;
487 template <
typename T =
void>
488 struct statics_unsigned___int20
490 typedef unsigned __int20 value_type;
492 static ETL_CONSTANT
unsigned __int20 min = 0;
493 static ETL_CONSTANT
unsigned __int20 max = 0xFFFFF;
494 static ETL_CONSTANT
int bits = 20;
495 static ETL_CONSTANT
bool is_signed =
false;
498 template <
typename T>
499 ETL_CONSTANT
unsigned __int20 statics_unsigned___int20<T>::min;
501 template <
typename T>
502 ETL_CONSTANT
unsigned __int20 statics_unsigned___int20<T>::max;
504 template <
typename T>
505 ETL_CONSTANT
int statics_unsigned___int20<T>::bits;
507 template <
typename T>
508 ETL_CONSTANT
bool statics_unsigned___int20<T>::is_signed;
515 template <
typename T>
541 typedef char value_type;
608 #if ETL_USING_20BIT_TYPES
613 struct integral_limits<__int20> :
public private_integral_limits::statics___int20<>
618 struct integral_limits<unsigned __int20> :
public private_integral_limits::statics_unsigned___int20<>
Definition integral_limits.h:516
is_signed
Definition type_traits_generator.h:1074
bitset_ext
Definition absolute.h:39
Definition integral_limits.h:127
Definition integral_limits.h:236
Definition integral_limits.h:336
Definition integral_limits.h:286
Definition integral_limits.h:182
Definition integral_limits.h:77
Definition integral_limits.h:102
Definition integral_limits.h:261
Definition integral_limits.h:361
Definition integral_limits.h:311
Definition integral_limits.h:211
Definition integral_limits.h:152