25 #ifndef INCLUDED_SizedInt_h_GUID_E228EDD2_8659_488A_8D2D_8E9BF81E7A36
26 #define INCLUDED_SizedInt_h_GUID_E228EDD2_8659_488A_8D2D_8E9BF81E7A36
41 template <std::
size_t bytes,
bool isSigned>
struct sized_int;
43 #define OSVR_INT_TRAITS(BITS) \
44 template <> struct sized_int<sizeof(std::int##BITS##_t), true> { \
45 using type = std::int##BITS##_t; \
47 template <> struct sized_int<sizeof(std::uint##BITS##_t), false> { \
48 using type = std::uint##BITS##_t; \
54 #undef OSVR_INT_TRAITS
55 static const auto MAX_SIZE =
sizeof(std::uint64_t);
59 static const auto ERROR_SPECIALIZATION_SIZE = MAX_SIZE + 1;
62 template <
bool isSigned>
63 struct sized_int<ERROR_SPECIALIZATION_SIZE, isSigned> {};
66 template <std::
size_t bytes,
bool isSigned>
68 :
sized_int<(bytes > MAX_SIZE) ? ERROR_SPECIALIZATION_SIZE
72 static_assert(bytes <= MAX_SIZE,
73 "No standard integral types larger than [u]int64_t.");
79 template <std::
size_t minBytes,
bool isSigned = false>
85 #endif // INCLUDED_SizedInt_h_GUID_E228EDD2_8659_488A_8D2D_8E9BF81E7A36
The main namespace for all C++ elements of the framework, internal and external.
typename detail::sized_int< minBytes, isSigned >::type sized_int_t
#define OSVR_INT_TRAITS(BITS)
Set up specializations for the standard int types.