CppCommon  1.0.4.1
C++ Common Library
uint128.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_UINT128_H
10 #define CPPCOMMON_UINT128_H
11 
12 #include "string/format.h"
13 
14 #include <cstdint>
15 #include <iostream>
16 #include <stdexcept>
17 #include <string>
18 #include <type_traits>
19 #include <utility>
20 
21 namespace CppCommon {
22 
24 
27 class uint128_t
28 {
29 public:
30  uint128_t() noexcept;
31  uint128_t(int8_t value) noexcept;
32  uint128_t(uint8_t value) noexcept;
33  uint128_t(int16_t value) noexcept;
34  uint128_t(uint16_t value) noexcept;
35  uint128_t(int32_t value) noexcept;
36  uint128_t(uint32_t value) noexcept;
37  uint128_t(int64_t value) noexcept;
38  uint128_t(uint64_t value) noexcept;
39  template <typename T>
40  explicit uint128_t(const T& value) noexcept;
41  template <typename TUpper, typename TLower>
42  uint128_t(const TUpper& upper, const TLower& lower) noexcept;
43  uint128_t(const uint128_t& value) noexcept = default;
44  uint128_t(uint128_t&& value) noexcept = default;
45  ~uint128_t() noexcept = default;
46 
47  template <typename T>
48  uint128_t& operator=(const T& value) noexcept;
49  uint128_t& operator=(const uint128_t& value) noexcept = default;
50  uint128_t& operator=(uint128_t&& value) noexcept = default;
51 
52  // Arithmetic operators
53  uint128_t operator+() const noexcept { return *this; }
54  uint128_t operator-() const noexcept { return ~*this + 1; }
55 
56  uint128_t& operator++() noexcept { return *this += 1; }
57  uint128_t operator++(int) noexcept { uint128_t temp(*this); ++*this; return temp; }
58  uint128_t& operator--() noexcept { return *this -= 1; }
59  uint128_t operator--(int) noexcept { uint128_t temp(*this); --*this; return temp; }
60 
61  uint128_t& operator+=(const uint128_t& value) noexcept { return *this = *this + value; }
62  uint128_t& operator-=(const uint128_t& value) noexcept { return *this = *this - value; }
63  uint128_t& operator*=(const uint128_t& value) noexcept { return *this = *this * value; }
64  uint128_t& operator/=(const uint128_t& value) { return *this = *this / value; }
65  uint128_t& operator%=(const uint128_t& value) { return *this = *this % value; }
66 
67  template <typename T>
68  uint128_t& operator+=(const T& value) noexcept { return *this = *this + uint128_t(value); }
69  template <typename T>
70  uint128_t& operator-=(const T& value) noexcept { return *this = *this - uint128_t(value); }
71  template <typename T>
72  uint128_t& operator*=(const T& value) noexcept { return *this = *this * uint128_t(value); }
73  template <typename T>
74  uint128_t& operator/=(const T& value) { return *this = *this / uint128_t(value); }
75  template <typename T>
76  uint128_t& operator%=(const T& value) { return *this = *this % uint128_t(value); }
77 
78  template <typename T>
79  friend T& operator+=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) + value2); }
80  template <typename T>
81  friend T& operator-=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) - value2); }
82  template <typename T>
83  friend T& operator*=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) * value2); }
84  template <typename T>
85  friend T& operator/=(T& value1, const uint128_t& value2) { return value1 = (T)(uint128_t(value1) / value2); }
86  template <typename T>
87  friend T& operator%=(T& value1, const uint128_t& value2) { return value1 = (T)(uint128_t(value1) % value2); }
88 
89  template <typename T>
90  friend uint128_t operator+(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) + value2; }
91  template <typename T>
92  friend uint128_t operator+(const uint128_t& value1, const T& value2) noexcept { return value1 + uint128_t(value2); }
93  friend uint128_t operator+(const uint128_t& value1, const uint128_t& value2) noexcept;
94 
95  template <typename T>
96  friend uint128_t operator-(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) - value2; }
97  template <typename T>
98  friend uint128_t operator-(const uint128_t& value1, const T& value2) noexcept { return value1 - uint128_t(value2); }
99  friend uint128_t operator-(const uint128_t& value1, const uint128_t& value2) noexcept;
100 
101  template <typename T>
102  friend uint128_t operator*(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) * value2; }
103  template <typename T>
104  friend uint128_t operator*(const uint128_t& value1, const T& value2) noexcept { return value1 * uint128_t(value2); }
105  friend uint128_t operator*(const uint128_t& value1, const uint128_t& value2) noexcept;
106 
107  template <typename T>
108  friend uint128_t operator/(const T& value1, const uint128_t& value2) { return uint128_t(value1) / value2; }
109  template <typename T>
110  friend uint128_t operator/(const uint128_t& value1, const T& value2) { return value1 / uint128_t(value2); }
111  friend uint128_t operator/(const uint128_t& value1, const uint128_t& value2);
112 
113  template <typename T>
114  friend uint128_t operator%(const T& value1, const uint128_t& value2) { return uint128_t(value1) % value2; }
115  template <typename T>
116  friend uint128_t operator%(const uint128_t& value1, const T& value2) { return value1 % uint128_t(value2); }
117  friend uint128_t operator%(const uint128_t& value1, const uint128_t& value2);
118 
119  // Bit operators
120  uint128_t operator~() const noexcept { return uint128_t(~_upper, ~_lower); }
121 
122  uint128_t& operator&=(const uint128_t& value) noexcept { return *this = *this & value; }
123  uint128_t& operator|=(const uint128_t& value) noexcept { return *this = *this | value; }
124  uint128_t& operator^=(const uint128_t& value) noexcept { return *this = *this ^ value; }
125 
126  template <typename T>
127  uint128_t& operator&=(const T& value) noexcept { return *this = *this & uint128_t(value); }
128  template <typename T>
129  uint128_t& operator|=(const T& value) noexcept { return *this = *this | uint128_t(value); }
130  template <typename T>
131  uint128_t& operator^=(const T& value) noexcept { return *this = *this ^ uint128_t(value); }
132 
133  template <typename T>
134  friend T& operator&=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) & value2); }
135  template <typename T>
136  friend T& operator|=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) | value2); }
137  template <typename T>
138  friend T& operator^=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) ^ value2); }
139 
140  template <typename T>
141  friend uint128_t operator&(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) & value2; }
142  template <typename T>
143  friend uint128_t operator&(const uint128_t& value1, const T& value2) noexcept { return value1 & uint128_t(value2); }
144  friend uint128_t operator&(const uint128_t& value1, const uint128_t& value2) noexcept;
145 
146  template <typename T>
147  friend uint128_t operator|(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) | value2; }
148  template <typename T>
149  friend uint128_t operator|(const uint128_t& value1, const T& value2) noexcept { return value1 | uint128_t(value2); }
150  friend uint128_t operator|(const uint128_t& value1, const uint128_t& value2) noexcept;
151 
152  template <typename T>
153  friend uint128_t operator^(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) ^ value2; }
154  template <typename T>
155  friend uint128_t operator^(const uint128_t& value1, const T& value2) noexcept { return value1 ^ uint128_t(value2); }
156  friend uint128_t operator^(const uint128_t& value1, const uint128_t& value2) noexcept;
157 
158  // Comparison operators
159  template <typename T>
160  friend bool operator==(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) == value2; }
161  template <typename T>
162  friend bool operator==(const uint128_t& value1, const T& value2) noexcept { return value1 == uint128_t(value2); }
163  friend bool operator==(const uint128_t& value1, const uint128_t& value2) noexcept;
164 
165  template <typename T>
166  friend bool operator!=(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) != value2; }
167  template <typename T>
168  friend bool operator!=(const uint128_t& value1, const T& value2) noexcept { return value1 != uint128_t(value2); }
169  friend bool operator!=(const uint128_t& value1, const uint128_t& value2) noexcept;
170 
171  template <typename T>
172  friend bool operator<(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) < value2; }
173  template <typename T>
174  friend bool operator<(const uint128_t& value1, const T& value2) noexcept { return value1 < uint128_t(value2); }
175  friend bool operator<(const uint128_t& value1, const uint128_t& value2) noexcept;
176 
177  template <typename T>
178  friend bool operator>(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) > value2; }
179  template <typename T>
180  friend bool operator>(const uint128_t& value1, const T& value2) noexcept { return value1 > uint128_t(value2); }
181  friend bool operator>(const uint128_t& value1, const uint128_t& value2) noexcept;
182 
183  template <typename T>
184  friend bool operator<=(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) <= value2; }
185  template <typename T>
186  friend bool operator<=(const uint128_t& value1, const T& value2) noexcept { return value1 <= uint128_t(value2); }
187  friend bool operator<=(const uint128_t& value1, const uint128_t& value2) noexcept;
188 
189  template <typename T>
190  friend bool operator>=(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) >= value2; }
191  template <typename T>
192  friend bool operator>=(const uint128_t& value1, const T& value2) noexcept { return value1 >= uint128_t(value2); }
193  friend bool operator>=(const uint128_t& value1, const uint128_t& value2) noexcept;
194 
195  // Logical operators
196  bool operator!() const noexcept { return !(bool)(_upper | _lower); }
197 
198  template <typename T>
199  friend bool operator&&(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) && value2; }
200  template <typename T>
201  friend bool operator&&(const uint128_t& value1, const T& value2) noexcept { return value1 && uint128_t(value2); }
202  friend bool operator&&(const uint128_t& value1, const uint128_t& value2) noexcept;
203 
204  template <typename T>
205  friend bool operator||(const T& value1, const uint128_t& value2) noexcept { return uint128_t(value1) || value2; }
206  template <typename T>
207  friend bool operator||(const uint128_t& value1, const T& value2) noexcept { return value1 || uint128_t(value2); }
208  friend bool operator||(const uint128_t& value1, const uint128_t& value2) noexcept;
209 
210  // Shift operators
211  uint128_t& operator<<=(const uint128_t& value) noexcept { return *this = *this << value; }
212  uint128_t& operator>>=(const uint128_t& value) noexcept { return *this = *this >> value; }
213 
214  template <typename T>
215  uint128_t& operator<<=(const T& value) noexcept { return *this = *this << uint128_t(value); }
216  template <typename T>
217  uint128_t& operator>>=(const T& value) noexcept { return *this = *this >> uint128_t(value); }
218 
219  template <typename T>
220  friend T& operator<<=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) << value2); }
221  template <typename T>
222  friend T& operator>>=(T& value1, const uint128_t& value2) noexcept { return value1 = (T)(uint128_t(value1) >> value2); }
223 
224  template <typename T>
225  friend uint128_t operator<<(const uint128_t& value1, const T& value2) noexcept { return value1 << uint128_t(value2); }
226  friend uint128_t operator<<(bool value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
227  friend uint128_t operator<<(int8_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
228  friend uint128_t operator<<(int16_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
229  friend uint128_t operator<<(int32_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
230  friend uint128_t operator<<(int64_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
231  friend uint128_t operator<<(uint8_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
232  friend uint128_t operator<<(uint16_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
233  friend uint128_t operator<<(uint32_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
234  friend uint128_t operator<<(uint64_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) << value2; }
235  friend uint128_t operator<<(const uint128_t& value1, const uint128_t& value2) noexcept;
236 
237  template <typename T>
238  friend uint128_t operator>>(const uint128_t& value1, const T& value2) noexcept { return value1 >> uint128_t(value2); }
239  friend uint128_t operator>>(bool value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
240  friend uint128_t operator>>(int8_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
241  friend uint128_t operator>>(int16_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
242  friend uint128_t operator>>(int32_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
243  friend uint128_t operator>>(int64_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
244  friend uint128_t operator>>(uint8_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
245  friend uint128_t operator>>(uint16_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
246  friend uint128_t operator>>(uint32_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
247  friend uint128_t operator>>(uint64_t value1, const uint128_t& value2) noexcept { return uint128_t(value1) >> value2; }
248  friend uint128_t operator>>(const uint128_t& value1, const uint128_t& value2) noexcept;
249 
250  // Type cast
251  operator bool() const noexcept { return (bool)(_upper | _lower); }
252  operator uint8_t() const noexcept { return (uint8_t)_lower; }
253  operator uint16_t() const noexcept { return (uint16_t)_lower; }
254  operator uint32_t() const noexcept { return (uint32_t)_lower; }
255  operator uint64_t() const noexcept { return (uint64_t)_lower; }
256 
258  uint64_t upper() const noexcept { return _upper; }
260  uint64_t lower() const noexcept { return _lower; }
261 
263  size_t bits() const noexcept;
264 
266 
271  std::string string(size_t base = 10, size_t length = 0) const;
273 
278  std::wstring wstring(size_t base = 10, size_t length = 0) const;
279 
281 
286  static std::pair<uint128_t, uint128_t> divmod(const uint128_t& x, const uint128_t& y);
287 
289  friend std::istream& operator>>(std::istream& is, uint128_t& value)
290  { is >> value._upper >> value._lower; return is; }
292  friend std::wistream& operator>>(std::wistream& is, uint128_t& value)
293  { is >> value._upper >> value._lower; return is; }
295  friend std::ostream& operator<<(std::ostream& os, const uint128_t& value);
297  friend std::wostream& operator<<(std::wostream& os, const uint128_t& value);
298 
300  void swap(uint128_t& value) noexcept;
301  friend void swap(uint128_t& value1, uint128_t& value2) noexcept;
302 
303 private:
304  uint64_t _upper;
305  uint64_t _lower;
306 };
307 
310 } // namespace CppCommon
311 
312 #include "uint128.inl"
313 
314 #endif // CPPCOMMON_UINT128_H
Unsigned 128-bit integer type.
Definition: uint128.h:28
uint128_t & operator>>=(const T &value) noexcept
Definition: uint128.h:217
static std::pair< uint128_t, uint128_t > divmod(const uint128_t &x, const uint128_t &y)
Calculate quotient and remainder when dividing X by Y.
Definition: uint128.cpp:171
friend uint128_t operator>>(int8_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:240
uint128_t & operator%=(const uint128_t &value)
Definition: uint128.h:65
void swap(uint128_t &value) noexcept
Swap two instances.
Definition: uint128.inl:177
friend bool operator>(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:178
uint128_t & operator>>=(const uint128_t &value) noexcept
Definition: uint128.h:212
friend uint128_t operator>>(uint8_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:244
friend uint128_t operator-(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:98
friend uint128_t operator/(const uint128_t &value1, const T &value2)
Definition: uint128.h:110
friend T & operator<<=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:220
friend uint128_t operator>>(int16_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:241
uint128_t & operator+=(const T &value) noexcept
Definition: uint128.h:68
friend uint128_t operator&(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:143
uint128_t & operator<<=(const T &value) noexcept
Definition: uint128.h:215
friend uint128_t operator*(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:102
friend uint128_t operator>>(int32_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:242
friend uint128_t operator<<(bool value1, const uint128_t &value2) noexcept
Definition: uint128.h:226
friend bool operator<(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:172
uint128_t & operator-=(const T &value) noexcept
Definition: uint128.h:70
uint128_t & operator&=(const uint128_t &value) noexcept
Definition: uint128.h:122
friend bool operator||(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:207
uint128_t & operator^=(const T &value) noexcept
Definition: uint128.h:131
uint128_t operator~() const noexcept
Definition: uint128.h:120
friend uint128_t operator<<(int32_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:229
uint128_t() noexcept
Definition: uint128.inl:11
uint128_t(uint128_t &&value) noexcept=default
uint128_t & operator++() noexcept
Definition: uint128.h:56
friend uint128_t operator>>(int64_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:243
friend uint128_t operator+(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:90
friend bool operator>(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:180
uint128_t(const uint128_t &value) noexcept=default
friend uint128_t operator/(const T &value1, const uint128_t &value2)
Definition: uint128.h:108
friend bool operator<=(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:186
uint128_t & operator^=(const uint128_t &value) noexcept
Definition: uint128.h:124
friend bool operator<=(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:184
uint128_t operator--(int) noexcept
Definition: uint128.h:59
friend T & operator*=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:83
friend bool operator!=(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:166
uint128_t & operator*=(const T &value) noexcept
Definition: uint128.h:72
uint128_t operator++(int) noexcept
Definition: uint128.h:57
uint128_t & operator+=(const uint128_t &value) noexcept
Definition: uint128.h:61
uint128_t & operator|=(const uint128_t &value) noexcept
Definition: uint128.h:123
friend uint128_t operator%(const T &value1, const uint128_t &value2)
Definition: uint128.h:114
friend bool operator>=(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:190
uint128_t operator-() const noexcept
Definition: uint128.h:54
friend bool operator==(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:162
size_t bits() const noexcept
Get the count of bits.
Definition: uint128.cpp:94
friend T & operator&=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:134
friend uint128_t operator^(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:155
friend uint128_t operator-(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:96
friend T & operator-=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:81
friend uint128_t operator>>(bool value1, const uint128_t &value2) noexcept
Definition: uint128.h:239
friend uint128_t operator<<(uint64_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:234
uint128_t operator+() const noexcept
Definition: uint128.h:53
friend uint128_t operator>>(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:238
uint128_t & operator|=(const T &value) noexcept
Definition: uint128.h:129
uint128_t & operator*=(const uint128_t &value) noexcept
Definition: uint128.h:63
uint128_t & operator/=(const uint128_t &value)
Definition: uint128.h:64
uint128_t & operator%=(const T &value)
Definition: uint128.h:76
friend uint128_t operator<<(int16_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:228
uint128_t & operator&=(const T &value) noexcept
Definition: uint128.h:127
friend uint128_t operator|(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:149
friend uint128_t operator*(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:104
std::wstring wstring(size_t base=10, size_t length=0) const
Get wide string from the current 128-bit integer.
Definition: uint128.cpp:146
friend bool operator&&(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:199
friend T & operator+=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:79
friend bool operator==(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:160
~uint128_t() noexcept=default
friend uint128_t operator&(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:141
friend std::wistream & operator>>(std::wistream &is, uint128_t &value)
Input instance from the given wide input stream.
Definition: uint128.h:292
uint64_t lower() const noexcept
Get the lower part of the 128-bit integer.
Definition: uint128.h:260
friend uint128_t operator<<(uint8_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:231
friend uint128_t operator^(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:153
uint128_t & operator--() noexcept
Definition: uint128.h:58
friend bool operator||(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:205
friend T & operator|=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:136
friend uint128_t operator+(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:92
friend bool operator!=(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:168
friend T & operator^=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:138
friend uint128_t operator<<(int8_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:227
friend uint128_t operator>>(uint64_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:247
friend T & operator>>=(T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:222
uint128_t & operator/=(const T &value)
Definition: uint128.h:74
friend uint128_t operator%(const uint128_t &value1, const T &value2)
Definition: uint128.h:116
friend uint128_t operator>>(uint16_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:245
bool operator!() const noexcept
Definition: uint128.h:196
friend uint128_t operator>>(uint32_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:246
uint64_t upper() const noexcept
Get the upper part of the 128-bit integer.
Definition: uint128.h:258
friend uint128_t operator<<(uint16_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:232
uint128_t & operator<<=(const uint128_t &value) noexcept
Definition: uint128.h:211
friend T & operator/=(T &value1, const uint128_t &value2)
Definition: uint128.h:85
friend uint128_t operator<<(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:225
friend bool operator<(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:174
friend bool operator>=(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:192
friend uint128_t operator<<(uint32_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:233
friend uint128_t operator|(const T &value1, const uint128_t &value2) noexcept
Definition: uint128.h:147
friend T & operator%=(T &value1, const uint128_t &value2)
Definition: uint128.h:87
uint128_t & operator-=(const uint128_t &value) noexcept
Definition: uint128.h:62
friend uint128_t operator<<(int64_t value1, const uint128_t &value2) noexcept
Definition: uint128.h:230
friend bool operator&&(const uint128_t &value1, const T &value2) noexcept
Definition: uint128.h:201
Format string definition.
C++ Common project definitions.
Definition: token_bucket.h:15
Unsigned 128-bit integer type inline implementation.