17 template<
class Ref,
class V>
18 inline static void assign(Ref&
self, V v) {
22 template<
class Ref,
class R>
34 struct IntegerBaseTrait<
uint_impl_t<N>, typename
std::enable_if<(N <= 32)>::type>
35 : ConstIntegerBaseTrait<uint_impl_t<N>> {
46 : ConstIntegerBaseTrait<uint_impl_t<N>> {
51 struct ConstIntegerBaseTrait<bool> {
56 struct IntegerBaseTrait<bool>
57 : ConstIntegerBaseTrait<bool> {
72 static_assert(bits > 0,
"bits must be non-negative");
73 static_assert(bits < 65,
"bits must be at most 64");
76 friend struct UinttDispatch<uint32_t>;
77 friend struct UinttDispatch<uint64_t>;
90 constexpr
operator unsigned char()
const {
return m_data; }
94 constexpr
operator signed char()
const {
return m_data; }
98 constexpr
operator char()
const {
return m_data; }
103 constexpr
operator unsigned int()
const {
return m_data; }
107 constexpr
operator unsigned short int()
const {
return m_data; }
111 constexpr
operator unsigned long int()
const {
return m_data; }
115 constexpr
operator unsigned long long int()
const {
return m_data; }
119 constexpr
operator int()
const {
return m_data; }
123 constexpr
operator short int()
const {
return m_data; }
127 constexpr
operator long int()
const {
return m_data; }
131 constexpr
operator long long int()
const {
return m_data; }
135 inline std::ostream& operator<<(std::ostream& os, const uint_impl_t<N>& v) {
136 return os << uint64_t(v);
167 static_assert(
sizeof(
uint_t<8>) == 1,
"sanity check");
168 static_assert(
sizeof(
uint_t<16>) == 2,
"sanity check");
169 static_assert(
sizeof(
uint_t<24>) == 3,
"sanity check");
170 static_assert(
sizeof(
uint_t<32>) == 4,
"sanity check");
171 static_assert(
sizeof(
uint_t<40>) == 5,
"sanity check");
172 static_assert(
sizeof(
uint_t<48>) == 6,
"sanity check");
173 static_assert(
sizeof(
uint_t<56>) == 7,
"sanity check");
174 static_assert(
sizeof(
uint_t<64>) == 8,
"sanity check");
176 static_assert(
sizeof(
uint_t<7>) == 1,
"sanity check");
177 static_assert(
sizeof(
uint_t<15>) == 2,
"sanity check");
178 static_assert(
sizeof(
uint_t<23>) == 3,
"sanity check");
179 static_assert(
sizeof(
uint_t<31>) == 4,
"sanity check");
180 static_assert(
sizeof(
uint_t<39>) == 5,
"sanity check");
181 static_assert(
sizeof(
uint_t<47>) == 6,
"sanity check");
182 static_assert(
sizeof(
uint_t<55>) == 7,
"sanity check");
183 static_assert(
sizeof(
uint_t<63>) == 8,
"sanity check");
185 static_assert(
sizeof(
uint_t<9>) == 2,
"sanity check");
186 static_assert(
sizeof(
uint_t<17>) == 3,
"sanity check");
187 static_assert(
sizeof(
uint_t<25>) == 4,
"sanity check");
188 static_assert(
sizeof(
uint_t<33>) == 5,
"sanity check");
189 static_assert(
sizeof(
uint_t<41>) == 6,
"sanity check");
190 static_assert(
sizeof(
uint_t<49>) == 7,
"sanity check");
191 static_assert(
sizeof(
uint_t<57>) == 8,
"sanity check");
200 static constexpr
bool is_specialized =
true;
201 static constexpr
bool is_signed =
false;
202 static constexpr
bool is_integer =
true;
203 static constexpr
bool is_exact =
true;
204 static constexpr
bool has_infinity =
false;
205 static constexpr
bool has_quiet_NaN =
false;
206 static constexpr
bool has_signaling_NaN =
false;
207 static constexpr std::float_denorm_style has_denorm = std::denorm_absent;
208 static constexpr
bool has_denorm_loss =
false;
209 static constexpr std::float_round_style round_style = std::round_toward_zero;
210 static constexpr
bool is_iec559 =
false;
211 static constexpr
bool is_bounded =
true;
214 static constexpr
bool is_modulo =
false;
216 static constexpr
int digits = N;
217 static constexpr
int digits10 = std::numeric_limits<T>::digits * std::log10(2);
218 static constexpr
int max_digits10 = 0;
219 static constexpr
int radix = 2;
220 static constexpr
int min_exponent = 0;
221 static constexpr
int min_exponent10 = 0;
222 static constexpr
int max_exponent = 0;
223 static constexpr
int max_exponent10 = 0;
226 static constexpr
bool traps =
true;
227 static constexpr
bool tinyness_before =
false;
229 static constexpr T
min() {
return 0; }
230 static constexpr T
lowest() {
return 0; }
231 static constexpr T
max() {
return uint64_t(std::pow(2, N) - 1); }
248 return hash<uint64_t>()(x);
uint_impl_t & operator=(long long int data)
Contains the text compression and encoding framework.
uint_impl_t & operator=(const uint_impl_t &b)
IntegerBaseCombiner< IntegerBaseWithSelf< Self >, IntegerBaseWith32< Self, unsigned char >, IntegerBaseWith32< Self, char >, IntegerBaseWith32< Self, signed char >, IntegerBaseWith32< Self, unsigned short int >, IntegerBaseWith32< Self, signed short int >, IntegerBaseWith32< Self, unsigned int >, IntegerBaseWith32< Self, signed int >, IntegerBaseWith64< Self, unsigned long int >, IntegerBaseWith64< Self, signed long int >, IntegerBaseWith64< Self, unsigned long long int >, IntegerBaseWith64< Self, signed long long int > > IntegerBase
constexpr uint_impl_t(int i)
static R cast_for_op(const Ref &self)
UinttDispatch< uint32_t > Dispatch
uint_impl_t & operator=(signed char data)
static void assign(Ref &self, V v)
uint_impl_t & operator=(long int data)
std::string to_string(tdc::uint_impl_t< N > value)
constexpr uint_impl_t(unsigned long long int i)
constexpr uint_impl_t(long int i)
uint_impl_t & operator=(unsigned long long int data)
static constexpr T signaling_NaN()
constexpr uint_impl_t(unsigned int i)
static constexpr T round_error()
uint_impl_t & operator=(unsigned int data)
uint_impl_t & operator=(int data)
constexpr uint_impl_t(short int i)
std::istream & operator>>(std::istream &is, uint_impl_t< N > &v)
constexpr uint_impl_t & operator=(char data)
typename uint_dispatch_t< N >::type uint_t
uint_impl_t & operator=(short int data)
static constexpr T epsilon()
UinttDispatch< uint64_t > Dispatch
static constexpr T quiet_NaN()
friend struct UinttDispatch< uint32_t >
UinttDispatch< uint32_t > Dispatch
constexpr uint_impl_t(unsigned short int i)
static constexpr T denorm_min()
friend struct UinttDispatch< uint64_t >
uint_impl_t & operator=(unsigned long int data)
constexpr uint_impl_t(unsigned long int i)
Custom integer type for storing values of arbitrary bit size bits.
uint_impl_t & operator=(unsigned short int data)
class tdc::uint_impl_t< 1 > __attribute__
size_t operator()(const tdc::uint_impl_t< N > &x) const
constexpr uint_impl_t(signed char i)
constexpr uint_impl_t(char i)
static constexpr T lowest()
constexpr uint_impl_t(long long int i)
static constexpr T infinity()