32#error THIS HEADER IS A GENERATOR. DO NOT INCLUDE.
53#ifndef ETL_SMALLEST_INCLUDED
54#define ETL_SMALLEST_INCLUDED
66#if ETL_USING_CPP11 && !defined(ETL_SMALLEST_TYPE_FORCE_CPP03_IMPLEMENTATION)
73 template <
typename T1,
typename... TRest>
79 using smallest_other =
typename smallest_type<TRest...>::type;
100 template <
typename T1>
101 class smallest_type<T1>
114 template <
typename... T>
115 using smallest_type_t =
typename smallest_type<T...>::type;
119 template <
typename... T>
120 constexpr size_t smallest_type_v = smallest_type<T...>
::size;
131 template <
typename T1,
typename T2 = void,
typename T3 = void,
typename T4 = void,
132 typename T5 = void,
typename T6 = void,
typename T7 = void,
typename T8 = void,
133 typename T9 = void,
typename T10 = void,
typename T11 = void,
typename T12 = void,
134 typename T13 = void,
typename T14 = void,
typename T15 = void,
typename T16 =
void>
140 template <
bool Boolean,
typename TrueType,
typename FalseType>
145 template <
typename TrueType,
typename FalseType>
153 template <
typename TrueType,
typename FalseType>
162 typedef typename smallest_type<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::type smallest_other;
166 typedef typename choose_type<(
sizeof(
T1) <
sizeof(smallest_other)),
181 template <
typename T1>
194 namespace private_smallest
200 struct best_fit_uint_type;
206 struct best_fit_uint_type<0>
215 struct best_fit_uint_type<1>
217 typedef uint_least16_t type;
224 struct best_fit_uint_type<2>
226 typedef uint_least32_t type;
229#if ETL_USING_64BIT_TYPES
259 struct best_fit_int_type<1>
268 struct best_fit_int_type<2>
270 typedef int_least32_t type;
273#if ETL_USING_64BIT_TYPES
291 template <
size_t NBITS>
297 static ETL_CONSTANT
int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
298 ((NBITS > 16) ? 1 : 0) +
299 ((NBITS > 32) ? 1 : 0);
306 template <
size_t NBITS>
307 ETL_CONSTANT
int smallest_uint_for_bits<NBITS>::TYPE_INDEX;
310 template <
size_t NBITS>
311 using smallest_uint_for_bits_t =
typename smallest_uint_for_bits<NBITS>::type;
320 template <
size_t NBITS>
321 struct smallest_int_for_bits
326 static ETL_CONSTANT
int TYPE_INDEX = ((NBITS > 8) ? 1 : 0) +
327 ((NBITS > 16) ? 1 : 0) +
328 ((NBITS > 32) ? 1 : 0);
332 typedef typename private_smallest::best_fit_int_type<TYPE_INDEX>::type type;
335 template <
size_t NBITS>
336 ETL_CONSTANT
int smallest_int_for_bits<NBITS>::TYPE_INDEX;
339 template <
size_t NBITS>
340 using smallest_int_for_bits_t =
typename smallest_int_for_bits<NBITS>::type;
349 template <u
intmax_t VALUE>
350 struct smallest_uint_for_value
355 static ETL_CONSTANT
int TYPE_INDEX = ((VALUE > UINT_LEAST8_MAX) ? 1 : 0) +
356 ((VALUE > UINT16_MAX) ? 1 : 0) +
357 ((VALUE > UINT32_MAX) ? 1 : 0);
361 typedef typename private_smallest::best_fit_uint_type<TYPE_INDEX>::type type;
364 template <u
intmax_t VALUE>
365 ETL_CONSTANT
int smallest_uint_for_value<VALUE>::TYPE_INDEX;
368 template <u
intmax_t VALUE>
369 using smallest_uint_for_value_t =
typename smallest_uint_for_value<VALUE>::type;
378 template <
intmax_t VALUE>
379 struct smallest_int_for_value
384 static ETL_CONSTANT
int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
385 (((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
386 (((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
390 typedef typename private_smallest::best_fit_int_type<TYPE_INDEX>::type type;
393 template <
intmax_t VALUE>
394 ETL_CONSTANT
int smallest_int_for_value<VALUE>::TYPE_INDEX;
397 template <
intmax_t VALUE>
398 using smallest_int_for_value_t =
typename smallest_int_for_value<VALUE>::type;
Definition smallest.h:136
Template to determine the smallest unsigned int type that can contain a value with the specified numb...
Definition smallest_generator.h:323
conditional
Definition type_traits_generator.h:1155
bitset_ext
Definition absolute.h:38
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1187
pair holds two objects of arbitrary type
Definition utility.h:164
Definition smallest_generator.h:274
Definition smallest_generator.h:230
size_of
Definition type_traits_generator.h:1592