12 : _upper(0), _lower(0)
17 : _upper(0), _lower(value)
22 : _upper(0), _lower(value)
27 : _upper(0), _lower(value)
32 : _upper(0), _lower(value)
37 : _upper(0), _lower(value)
42 : _upper(0), _lower(value)
47 : _upper(0), _lower(value)
52 : _upper(0), _lower(value)
58 : _upper(0), _lower(value)
60 static_assert((std::is_integral<T>::value || std::is_same<T, uint128_t>::value),
"Input argument type must be an integer!");
63 template <
typename TUpper,
typename TLower>
65 : _upper(upper), _lower(lower)
67 static_assert(((std::is_integral<TUpper>::value || std::is_same<TUpper, uint128_t>::value) && (std::is_integral<TLower>::value || std::is_same<TLower, uint128_t>::value)),
"Input argument types must be integers!");
73 static_assert((std::is_integral<T>::value || std::is_same<T, uint128_t>::value),
"Input argument type must be an integer!");
82 return uint128_t(value1._upper + value2._upper + (((value1._lower + value2._lower) < value1._lower) ? 1 : 0), value1._lower + value2._lower);
87 return uint128_t(value1._upper - value2._upper - (((value1._lower - value2._lower) > value1._lower) ? 1 : 0), value1._lower - value2._lower);
102 return uint128_t(value1._upper & value2._upper, value1._lower & value2._lower);
107 return uint128_t(value1._upper | value2._upper, value1._lower | value2._lower);
112 return uint128_t(value1._upper ^ value2._upper, value1._lower ^ value2._lower);
117 return ((value1._upper == value2._upper) && (value1._lower == value2._lower));
122 return ((value1._upper != value2._upper) || (value1._lower != value2._lower));
127 return (value1._upper == value2._upper) ? (value1._lower < value2._lower) : (value1._upper < value2._upper);
132 return (value1._upper == value2._upper) ? (value1._lower > value2._lower) : (value1._upper > value2._upper);
137 return ((value1 < value2) || (value1 == value2));
142 return ((value1 > value2) || (value1 == value2));
147 return ((
bool)value1 && (
bool)value2);
152 return ((
bool)value1 || (
bool)value2);
157 if (os.flags() & os.oct)
159 else if (os.flags() & os.dec)
161 else if (os.flags() & os.hex)
168 if (os.flags() & os.oct)
170 else if (os.flags() & os.dec)
172 else if (os.flags() & os.hex)
180 swap(_upper, value._upper);
181 swap(_lower, value._lower);
191 #if defined(FMT_VERSION)
193 struct fmt::formatter<
CppCommon::uint128_t> : formatter<std::string_view>
195 template <
typename FormatContext>
208 typedef size_t result_type;
210 result_type operator() (
const argument_type& value)
const
212 result_type result = 17;
213 std::hash<uint64_t> hasher;
214 result = result * 31 + hasher(value.upper());
215 result = result * 31 + hasher(value.lower());
Unsigned 128-bit integer type.
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.
void swap(uint128_t &value) noexcept
Swap two instances.
uint128_t & operator=(const T &value) noexcept
std::wstring wstring(size_t base=10, size_t length=0) const
Get wide string from the current 128-bit integer.
std::string string(size_t base=10, size_t length=0) const
Get string from the current 128-bit integer.
C++ Common project definitions.
std::ostream & operator<<(std::ostream &os, const uint128_t &value)
constexpr auto operator|(TEnum value1, TEnum value2) noexcept -> typename std::enable_if< IsEnumFlags< TEnum >::value, Flags< TEnum >>::type
bool operator==(const uint128_t &value1, const uint128_t &value2) noexcept
std::string format(fmt::format_string< T... > pattern, T &&... args)
Format string.
uint128_t operator-(const uint128_t &value1, const uint128_t &value2) noexcept
bool operator!=(const uint128_t &value1, const uint128_t &value2) noexcept
void swap(uint128_t &value1, uint128_t &value2) noexcept
void swap(FileCache &cache1, FileCache &cache2) noexcept
constexpr auto operator^(TEnum value1, TEnum value2) noexcept -> typename std::enable_if< IsEnumFlags< TEnum >::value, Flags< TEnum >>::type
bool operator<(const uint128_t &value1, const uint128_t &value2) noexcept
bool operator>(const uint128_t &value1, const uint128_t &value2) noexcept
uint128_t operator%(const uint128_t &value1, const uint128_t &value2)
bool operator<=(const uint128_t &value1, const uint128_t &value2) noexcept
uint128_t operator+(const uint128_t &value1, const uint128_t &value2) noexcept
uint128_t operator/(const uint128_t &value1, const uint128_t &value2)
bool operator>=(const uint128_t &value1, const uint128_t &value2) noexcept
bool operator&&(const uint128_t &value1, const uint128_t &value2) noexcept
constexpr auto operator&(TEnum value1, TEnum value2) noexcept -> typename std::enable_if< IsEnumFlags< TEnum >::value, Flags< TEnum >>::type
bool operator||(const uint128_t &value1, const uint128_t &value2) noexcept