12 #ifndef ESTD_TYPEFROMSIZE_HPP_ 13 #define ESTD_TYPEFROMSIZE_HPP_ 15 #include <type_traits> 26 #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) 43 static_assert(size <=
sizeof(uint64_t),
"Max supported type is uint64_t!");
46 using Type =
typename std::conditional<size <=
sizeof(uint8_t), uint8_t,
47 typename std::conditional<size <=
sizeof(uint16_t), uint16_t,
48 typename std::conditional<size <=
sizeof(uint32_t), uint32_t, uint64_t>::type>::type>::type;
74 #endif // ESTD_TYPEFROMSIZE_HPP_ Collection of useful templates.
Definition: DmaChannel.hpp:121
Implementation of TypeFromSize.
Definition: TypeFromSize.hpp:41
typename internal::TypeFromSize< size >::Type TypeFromSize
Selects fixed width type from requested byte size.
Definition: TypeFromSize.hpp:60
#define STATIC_ASSERT(...)
Produces a static_assert() where the expression is also used as the message.
Definition: log2u.hpp:23
typename std::conditional< size<=sizeof(uint8_t), uint8_t, typename std::conditional< size<=sizeof(uint16_t), uint16_t, typename std::conditional< size<=sizeof(uint32_t), uint32_t, uint64_t >::type >::type >::type Type
one of fixed width types which is at least size bytes
Definition: TypeFromSize.hpp:48