30 #ifndef TINS_SMALL_UINT_H 31 #define TINS_SMALL_UINT_H 39 const char* what()
const throw() {
40 return "Value is too large";
54 template<
bool cond,
typename OnTrue,
typename OnFalse>
59 template<
typename OnTrue,
typename OnFalse>
60 struct if_then_else<false, OnTrue, OnFalse> {
66 typedef typename if_then_else<
69 typename if_then_else<
72 typename if_then_else<
81 template<u
int64_t base, u
int64_t pow>
83 static const uint64_t value = base * power<base, pow - 1>::value;
86 template<u
int64_t base>
87 struct power<base, 0> {
88 static const uint64_t value = 1;
99 static const repr_type max_value = power<2, n>::value - 1;
115 if (val > max_value) {
124 operator repr_type()
const {
133 #endif // TINS_SMALL_UINT_H Definition: small_uint.h:37
small_uint()
Definition: small_uint.h:104
Represents a field of n bits.
Definition: small_uint.h:52
The Tins namespace.
Definition: address_range.h:38
small_uint(repr_type val)
Copy constructs the stored value.
Definition: small_uint.h:114
best_type< n >::type repr_type
Definition: small_uint.h:94