ipaddress 1.1.0
|
Defines uint128_t
, a portable 128-bit unsigned integer type.
More...
Go to the source code of this file.
Classes | |
class | uint128_t |
Class for representing a 128-bit unsigned integer. More... | |
Namespaces | |
namespace | ipaddress |
Namespace dedicated to IP addresses and networks operations. | |
Functions | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator+ (T lower, const uint128_t &value) noexcept |
Performs addition between an integer and a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator- (T lower, const uint128_t &value) noexcept |
Performs subtraction of a uint128_t value from an integer. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator* (T lower, const uint128_t &value) noexcept |
Performs multiplication between an integer and a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator/ (T lower, const uint128_t &value) noexcept |
Performs division of an integer by a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator% (T lower, const uint128_t &value) noexcept |
Calculates the remainder of division of an integer by a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator& (T lower, const uint128_t &value) noexcept |
Performs bitwise AND operation between an integer and a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator| (T lower, const uint128_t &value) noexcept |
Performs bitwise OR operation between an integer and a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type> | |
constexpr inline uint128_t | operator^ (T lower, const uint128_t &value) noexcept |
Performs bitwise XOR operation between an integer and a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
constexpr inline bool | operator== (T lower, const uint128_t &other) noexcept |
Checks if an integer value is equal to a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
constexpr inline bool | operator!= (T lower, const uint128_t &other) noexcept |
Checks if an integer value is not equal to a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
constexpr inline bool | operator< (T lower, const uint128_t &other) noexcept |
Compares if an integer value is less than a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
constexpr inline bool | operator> (T lower, const uint128_t &other) noexcept |
Compares if an integer value is greater than a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
constexpr inline bool | operator<= (T lower, const uint128_t &other) noexcept |
Compares if an integer value is less than or equal to a uint128_t value. | |
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type> | |
constexpr inline bool | operator>= (T lower, const uint128_t &other) noexcept |
Compares if an integer value is greater than or equal to a uint128_t value. | |
Defines uint128_t
, a portable 128-bit unsigned integer type.
This header introduces uint128_t
, a class that emulates a 128-bit unsigned integer. It is designed to fill the gap in the C++ standard, which does not natively support 128-bit integers across all platforms. Unlike compiler-specific extensions like __int128
, uint128_t
ensures compatibility and portability across different compilers and architectures. The implementation is inspired by the algorithms used in the .NET framework's UInt128, providing a reliable foundation for arithmetic operations and other integer-related functionalities. The class integrates seamlessly with the ipaddress
library, offering standard hash support and optional type compatibility.
The uint128_t
type is especially useful in applications requiring precise control over large integer values, such as cryptography, high-precision arithmetic, and IP address manipulation. Its design prioritizes accuracy, making it a robust tool for developers working with high-volume data or complex numerical computations.