ipaddress 1.1.0
Loading...
Searching...
No Matches
uint128_t Class Referencefinal

Class for representing a 128-bit unsigned integer. More...

#include <uint128.hpp>

Public Types

enum class  format {
  decimal = 0 ,
  octal ,
  hexadecimal
}
 Enumerates the string formats available for uint128_t. More...
 

Public Member Functions

constexpr inline uint128_t () noexcept=default
 Default constructor.
 
constexpr inline uint128_t (const uint128_t &other) noexcept=default
 Copy constructor.
 
constexpr inline uint128_t (uint128_t &&other) noexcept=default
 Move constructor.
 
constexpr inline uint128_toperator= (const uint128_t &other) noexcept=default
 Assignment operator.
 
constexpr inline uint128_toperator= (uint128_t &&other) noexcept=default
 Move assignment operator.
 
constexpr inline uint128_t (uint64_t upper, uint64_t lower) noexcept
 Constructs a uint128_t instance from upper and lower parts.
 
constexpr inline uint128_t (unsigned long long lower) noexcept
 Constructs a uint128_t instance from an unsigned integer.
 
constexpr inline uint128_t (unsigned long lower) noexcept
 Constructs a uint128_t instance from an unsigned integer.
 
constexpr inline uint128_t (unsigned int lower) noexcept
 Constructs a uint128_t instance from an unsigned integer.
 
constexpr inline uint128_t (unsigned short lower) noexcept
 Constructs a uint128_t instance from an unsigned integer.
 
constexpr inline uint128_t (long long lower) noexcept
 Constructs a uint128_t instance from a signed integer.
 
constexpr inline uint128_t (long lower) noexcept
 Constructs a uint128_t instance from a signed integer.
 
constexpr inline uint128_t (int lower) noexcept
 Constructs a uint128_t instance from a signed integer.
 
constexpr inline uint128_t (short lower) noexcept
 Constructs a uint128_t instance from a signed integer.
 
inline uint128_t (double value) noexcept
 Constructs a uint128_t instance from a floating-point value.
 
inline uint128_t (long double value) noexcept
 Constructs a uint128_t instance from a floating-point value.
 
inline uint128_t (float value) noexcept
 Constructs a uint128_t instance from a floating-point value.
 
constexpr inline uint64_t lower () const noexcept
 Retrieves the lower 64 bits of the uint128_t value.
 
constexpr inline uint64_t upper () const noexcept
 Retrieves the upper 64 bits of the uint128_t value.
 
constexpr inline size_t hash () const noexcept
 Computes the hash value of the uint128_t instance.
 
constexpr inline void swap (uint128_t &other) noexcept
 Swaps the values of two uint128_t instances.
 
inline std::string to_string (format fmt=format::decimal) const
 Converts the uint128_t value to a string representation.
 
inline std::wstring to_wstring (format fmt=format::decimal) const
 Converts the uint128_t value to a string representation.
 
inline std::u16string to_u16string (format fmt=format::decimal) const
 Converts the uint128_t value to a string representation.
 
inline std::u32string to_u32string (format fmt=format::decimal) const
 Converts the uint128_t value to a string representation.
 
inline std::u8string to_u8string (format fmt=format::decimal) const
 Converts the uint128_t value to a string representation.
 
constexpr inline operator bool () const noexcept
 Checks if the uint128_t value is non-zero.
 
constexpr inline operator unsigned long long () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator long long () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator unsigned long () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator long () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator unsigned int () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator int () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator unsigned short () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator short () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator unsigned char () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator char () const noexcept
 Casts the uint128_t value to an integral type.
 
constexpr inline operator signed char () const noexcept
 Casts the uint128_t value to an integral type.
 
inline operator long double () const noexcept
 Casts the uint128_t value to a floating-point type.
 
inline operator double () const noexcept
 Casts the uint128_t value to a floating-point type.
 
inline operator float () const noexcept
 Casts the uint128_t value to a floating-point type.
 
constexpr inline uint128_toperator+= (const uint128_t &other) noexcept
 Addition assignment operator.
 
constexpr inline uint128_toperator-= (const uint128_t &other) noexcept
 Subtraction assignment operator.
 
constexpr inline uint128_toperator*= (const uint128_t &other) noexcept
 Multiplication assignment operator.
 
constexpr inline uint128_toperator/= (const uint128_t &other) noexcept
 Division assignment operator.
 
constexpr inline uint128_toperator%= (const uint128_t &other) noexcept
 Remainder assignment operator.
 
constexpr inline uint128_toperator&= (const uint128_t &other) noexcept
 Bitwise AND assignment operator.
 
constexpr inline uint128_toperator|= (const uint128_t &other) noexcept
 Bitwise OR assignment operator.
 
constexpr inline uint128_toperator^= (const uint128_t &other) noexcept
 Bitwise XOR assignment operator.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_toperator<<= (T shift) noexcept
 Bitwise left shift assignment operator.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_toperator>>= (T shift) noexcept
 Bitwise right shift assignment operator.
 
constexpr inline uint128_t operator+ () const noexcept
 Unary plus operator.
 
constexpr inline uint128_t operator- () const noexcept
 Unary minus operator.
 
constexpr inline uint128_t operator~ () const noexcept
 Bitwise NOT operator.
 
constexpr inline uint128_t operator+ (const uint128_t &other) const noexcept
 Addition operator with another uint128_t instance.
 
constexpr inline uint128_t operator- (const uint128_t &other) const noexcept
 Subtraction operator with another uint128_t instance.
 
constexpr inline uint128_t operator* (const uint128_t &other) const noexcept
 Multiplication operator with another uint128_t instance.
 
constexpr inline uint128_t operator/ (const uint128_t &other) const noexcept
 Division operator with another uint128_t instance.
 
constexpr inline uint128_t operator% (const uint128_t &other) const noexcept
 Remainder operator with another uint128_t instance.
 
constexpr inline uint128_t operator& (const uint128_t &other) const noexcept
 Bitwise AND operator with another uint128_t instance.
 
constexpr inline uint128_t operator| (const uint128_t &other) const noexcept
 Bitwise OR operator with another uint128_t instance.
 
constexpr inline uint128_t operator^ (const uint128_t &other) const noexcept
 Bitwise XOR operator with another uint128_t instance.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_t operator<< (T shift) const noexcept
 Bitwise left shift operator with an integral type.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_t operator>> (T shift) const noexcept
 Bitwise right shift operator with an integral type.
 
constexpr inline uint128_toperator++ () noexcept
 Pre-increment operator.
 
constexpr inline uint128_toperator-- () noexcept
 Pre-decrement operator.
 
constexpr inline uint128_t operator++ (int) noexcept
 Post-increment operator.
 
constexpr inline uint128_t operator-- (int) noexcept
 Post-decrement operator.
 
constexpr inline bool operator! () const noexcept
 Logical NOT operator.
 
constexpr inline bool operator&& (const uint128_t &other) const noexcept
 Logical AND operator.
 
constexpr inline bool operator|| (const uint128_t &other) const noexcept
 Logical OR operator.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator== (T lower) const noexcept
 Equality operator with an integral type.
 
constexpr inline bool operator== (const uint128_t &other) const noexcept
 Equality operator with another uint128_t instance.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator!= (T lower) const noexcept
 Inequality operator with an integral type.
 
constexpr inline bool operator!= (const uint128_t &other) const noexcept
 Inequality operator with another uint128_t instance.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator< (T lower) const noexcept
 Less than operator with an integral type.
 
constexpr inline bool operator< (const uint128_t &other) const noexcept
 Less than operator with another uint128_t instance.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator> (T lower) const noexcept
 Greater than operator with an integral type.
 
constexpr inline bool operator> (const uint128_t &other) const noexcept
 Greater than operator with another uint128_t instance.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator<= (T lower) const noexcept
 Less than or equal to operator with an integral type.
 
constexpr inline bool operator<= (const uint128_t &other) const noexcept
 Less than or equal to operator with another uint128_t instance.
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator>= (T lower) const noexcept
 Greater than or equal to operator with an integral type.
 
constexpr inline bool operator>= (const uint128_t &other) const noexcept
 Greater than or equal to operator with another uint128_t instance.
 

Static Public Member Functions

static inline optional< uint128_tfrom_string (const std::string &str, format fmt=format::decimal) noexcept
 Parses a string to a uint128_t instance.
 
static inline optional< uint128_tfrom_string (const std::wstring &str, format fmt=format::decimal) noexcept
 Parses a string to a uint128_t instance.
 
static inline optional< uint128_tfrom_string (const std::u16string &str, format fmt=format::decimal) noexcept
 Parses a string to a uint128_t instance.
 
static inline optional< uint128_tfrom_string (const std::u32string &str, format fmt=format::decimal) noexcept
 Parses a string to a uint128_t instance.
 
static inline optional< uint128_tfrom_string (const std::u8string &str, format fmt=format::decimal) noexcept
 Parses a string to a uint128_t instance.
 
template<typename T , size_t N>
static constexpr inline optional< uint128_tfrom_string (const T(&str)[N], format fmt=format::decimal) noexcept
 Parses a string to a uint128_t instance.
 

Detailed Description

Class for representing a 128-bit unsigned integer.

uint128_t offers a comprehensive suite of operations and utilities for handling 128-bit unsigned integers. It supports basic arithmetic operations, bitwise logic, comparison operators, and specialized functions for advanced integer manipulation. The class is optimized for both space and time efficiency, ensuring minimal overhead and maximum performance.

The design of uint128_t is focused on ease of use and integration. It provides constructors for seamless conversion from built-in integer types, as well as explicit methods for converting to and from other numeric representations. The class also includes support for standard library features like hashing and optional values, enhancing its utility in a wide range of programming scenarios.

The implementation is based on algorithms from the .NET UInt128 structure, ensuring reliable and efficient operations.

See also
UInt128 .NET Implementation.

Member Enumeration Documentation

◆ format

enum class format
strong

Enumerates the string formats available for uint128_t.

This enumeration defines the possible string representations of uint128_t values. It allows users to specify the desired format when converting uint128_t instances to strings.

Enumerator
decimal 

Represents the number in decimal format.

This is the default format.

octal 

Represents the number in octal format.

hexadecimal 

Represents the number in hexadecimal format.

Constructor & Destructor Documentation

◆ uint128_t() [1/15]

constexpr inline uint128_t ( )
defaultnoexcept

Default constructor.

Constructs a new uint128_t instance with default values.

◆ uint128_t() [2/15]

constexpr inline uint128_t ( const uint128_t & other)
defaultnoexcept

Copy constructor.

Constructs a new uint128_t instance by copying the value from another instance.

Parameters
[in]otherThe uint128_t instance to copy.

◆ uint128_t() [3/15]

constexpr inline uint128_t ( uint128_t && other)
defaultnoexcept

Move constructor.

Constructs a new uint128_t instance by moving the value from another instance.

Parameters
[in,out]otherThe uint128_t instance to move.

◆ uint128_t() [4/15]

constexpr inline uint128_t ( uint64_t upper,
uint64_t lower )
inlinenoexcept

Constructs a uint128_t instance from upper and lower parts.

This constructor initializes a uint128_t instance using separate upper and lower 64-bit integers.

Parameters
[in]upperThe upper 64 bits of the uint128_t value.
[in]lowerThe lower 64 bits of the uint128_t value.

◆ uint128_t() [5/15]

constexpr inline uint128_t ( unsigned long long lower)
inlinenoexcept

Constructs a uint128_t instance from an unsigned integer.

This constructor initializes a uint128_t instance using an unsigned integer, setting it as the lower part of the uint128_t value.

Parameters
[in]lowerThe unsigned integer to initialize the uint128_t instance with.

◆ uint128_t() [6/15]

constexpr inline uint128_t ( unsigned long lower)
inlinenoexcept

Constructs a uint128_t instance from an unsigned integer.

This constructor initializes a uint128_t instance using an unsigned integer, setting it as the lower part of the uint128_t value.

Parameters
[in]lowerThe unsigned integer to initialize the uint128_t instance with.

◆ uint128_t() [7/15]

constexpr inline uint128_t ( unsigned int lower)
inlinenoexcept

Constructs a uint128_t instance from an unsigned integer.

This constructor initializes a uint128_t instance using an unsigned integer, setting it as the lower part of the uint128_t value.

Parameters
[in]lowerThe unsigned integer to initialize the uint128_t instance with.

◆ uint128_t() [8/15]

constexpr inline uint128_t ( unsigned short lower)
inlinenoexcept

Constructs a uint128_t instance from an unsigned integer.

This constructor initializes a uint128_t instance using an unsigned integer, setting it as the lower part of the uint128_t value.

Parameters
[in]lowerThe unsigned integer to initialize the uint128_t instance with.

◆ uint128_t() [9/15]

constexpr inline uint128_t ( long long lower)
inlinenoexcept

Constructs a uint128_t instance from a signed integer.

This constructor initializes a uint128_t instance using a signed integer, setting it as the lower part of the uint128_t value and extending the sign to the upper part.

Parameters
[in]lowerThe signed integer to initialize the uint128_t instance with.

◆ uint128_t() [10/15]

constexpr inline uint128_t ( long lower)
inlinenoexcept

Constructs a uint128_t instance from a signed integer.

This constructor initializes a uint128_t instance using a signed integer, setting it as the lower part of the uint128_t value and extending the sign to the upper part.

Parameters
[in]lowerThe signed integer to initialize the uint128_t instance with.

◆ uint128_t() [11/15]

constexpr inline uint128_t ( int lower)
inlinenoexcept

Constructs a uint128_t instance from a signed integer.

This constructor initializes a uint128_t instance using a signed integer, setting it as the lower part of the uint128_t value and extending the sign to the upper part.

Parameters
[in]lowerThe signed integer to initialize the uint128_t instance with.

◆ uint128_t() [12/15]

constexpr inline uint128_t ( short lower)
inlinenoexcept

Constructs a uint128_t instance from a signed integer.

This constructor initializes a uint128_t instance using a signed integer, setting it as the lower part of the uint128_t value and extending the sign to the upper part.

Parameters
[in]lowerThe signed integer to initialize the uint128_t instance with.

◆ uint128_t() [13/15]

inline uint128_t ( double value)
inlineexplicitnoexcept

Constructs a uint128_t instance from a floating-point value.

This constructor initializes a uint128_t instance by converting a floating-point value to its 128-bit unsigned integer representation. The conversion is explicit to prevent unintended implicit conversions.

Parameters
[in]valueThe floating-point value to convert.

◆ uint128_t() [14/15]

inline uint128_t ( long double value)
inlineexplicitnoexcept

Constructs a uint128_t instance from a floating-point value.

This constructor initializes a uint128_t instance by converting a floating-point value to its 128-bit unsigned integer representation. The conversion is explicit to prevent unintended implicit conversions.

Parameters
[in]valueThe floating-point value to convert.

◆ uint128_t() [15/15]

inline uint128_t ( float value)
inlineexplicitnoexcept

Constructs a uint128_t instance from a floating-point value.

This constructor initializes a uint128_t instance by converting a floating-point value to its 128-bit unsigned integer representation. The conversion is explicit to prevent unintended implicit conversions.

Parameters
[in]valueThe floating-point value to convert.

Member Function Documentation

◆ operator=() [1/2]

constexpr inline uint128_t & operator= ( const uint128_t & other)
defaultnoexcept

Assignment operator.

Assigns the value of one uint128_t instance to another.

Parameters
[in]otherThe uint128_t instance to assign from.
Returns
A reference to the assigned uint128_t instance.

◆ operator=() [2/2]

constexpr inline uint128_t & operator= ( uint128_t && other)
defaultnoexcept

Move assignment operator.

Moves the value of one uint128_t instance to another.

Parameters
[in,out]otherThe uint128_t instance to move from.
Returns
A reference to the moved uint128_t instance.

◆ lower()

constexpr inline uint64_t lower ( ) const
inlinenoexcept

Retrieves the lower 64 bits of the uint128_t value.

This method returns the lower part of the uint128_t instance, allowing access to the least significant bits.

Returns
The lower 64 bits as a uint64_t.

◆ upper()

constexpr inline uint64_t upper ( ) const
inlinenoexcept

Retrieves the upper 64 bits of the uint128_t value.

This method returns the upper part of the uint128_t instance, allowing access to the most significant bits.

Returns
The upper 64 bits as a uint64_t.

◆ hash()

constexpr inline size_t hash ( ) const
inlinenoexcept

Computes the hash value of the uint128_t instance.

This method calculates a hash value for the uint128_t instance, which can be used in hash-based data structures.

Returns
A size_t representing the hash value of the uint128_t instance.

◆ swap()

constexpr inline void swap ( uint128_t & other)
inlinenoexcept

Swaps the values of two uint128_t instances.

This method exchanges the contents of the uint128_t instance with those of another instance.

Parameters
[in,out]otherThe other uint128_t instance to swap with.

◆ to_string()

inline std::string to_string ( format fmt = format::decimal) const
inline

Converts the uint128_t value to a string representation.

This method converts the uint128_t instance to its string representation in the specified format. It supports decimal, octal, and hexadecimal formats.

Parameters
[in]fmtThe format to use for the conversion, with format::decimal as the default.
Returns
A std::string holding the converted value.

◆ to_wstring()

inline std::wstring to_wstring ( format fmt = format::decimal) const
inline

Converts the uint128_t value to a string representation.

This method converts the uint128_t instance to its string representation in the specified format. It supports decimal, octal, and hexadecimal formats.

Parameters
[in]fmtThe format to use for the conversion, with format::decimal as the default.
Returns
A std::wstring holding the converted value.

◆ to_u16string()

inline std::u16string to_u16string ( format fmt = format::decimal) const
inline

Converts the uint128_t value to a string representation.

This method converts the uint128_t instance to its string representation in the specified format. It supports decimal, octal, and hexadecimal formats.

Parameters
[in]fmtThe format to use for the conversion, with format::decimal as the default.
Returns
A std::u16string holding the converted value.

◆ to_u32string()

inline std::u32string to_u32string ( format fmt = format::decimal) const
inline

Converts the uint128_t value to a string representation.

This method converts the uint128_t instance to its string representation in the specified format. It supports decimal, octal, and hexadecimal formats.

Parameters
[in]fmtThe format to use for the conversion, with format::decimal as the default.
Returns
A std::u32string holding the converted value.

◆ to_u8string()

inline std::u8string to_u8string ( format fmt = format::decimal) const
inline

Converts the uint128_t value to a string representation.

This method converts the uint128_t instance to its string representation in the specified format. It supports decimal, octal, and hexadecimal formats.

Parameters
[in]fmtThe format to use for the conversion, with format::decimal as the default.
Returns
A std::u8string holding the converted value.

◆ from_string() [1/6]

static inline optional< uint128_t > from_string ( const std::string & str,
format fmt = format::decimal )
inlinestaticnoexcept

Parses a string to a uint128_t instance.

This static method attempts to parse a given string as a uint128_t value in the specified format. If the parsing is successful, it returns an optional containing the parsed uint128_t value.

Parameters
[in]strThe input string to parse.
[in]fmtThe string format to interpret the input string (defaults to decimal).
Returns
An optional containing the parsed uint128_t value if successful, otherwise an empty optional.

◆ from_string() [2/6]

static inline optional< uint128_t > from_string ( const std::wstring & str,
format fmt = format::decimal )
inlinestaticnoexcept

Parses a string to a uint128_t instance.

This static method attempts to parse a given string as a uint128_t value in the specified format. If the parsing is successful, it returns an optional containing the parsed uint128_t value.

Parameters
[in]strThe input string to parse.
[in]fmtThe string format to interpret the input string (defaults to decimal).
Returns
An optional containing the parsed uint128_t value if successful, otherwise an empty optional.

◆ from_string() [3/6]

static inline optional< uint128_t > from_string ( const std::u16string & str,
format fmt = format::decimal )
inlinestaticnoexcept

Parses a string to a uint128_t instance.

This static method attempts to parse a given string as a uint128_t value in the specified format. If the parsing is successful, it returns an optional containing the parsed uint128_t value.

Parameters
[in]strThe input string to parse.
[in]fmtThe string format to interpret the input string (defaults to decimal).
Returns
An optional containing the parsed uint128_t value if successful, otherwise an empty optional.

◆ from_string() [4/6]

static inline optional< uint128_t > from_string ( const std::u32string & str,
format fmt = format::decimal )
inlinestaticnoexcept

Parses a string to a uint128_t instance.

This static method attempts to parse a given string as a uint128_t value in the specified format. If the parsing is successful, it returns an optional containing the parsed uint128_t value.

Parameters
[in]strThe input string to parse.
[in]fmtThe string format to interpret the input string (defaults to decimal).
Returns
An optional containing the parsed uint128_t value if successful, otherwise an empty optional.

◆ from_string() [5/6]

static inline optional< uint128_t > from_string ( const std::u8string & str,
format fmt = format::decimal )
inlinestaticnoexcept

Parses a string to a uint128_t instance.

This static method attempts to parse a given string as a uint128_t value in the specified format. If the parsing is successful, it returns an optional containing the parsed uint128_t value.

Parameters
[in]strThe input string to parse.
[in]fmtThe string format to interpret the input string (defaults to decimal).
Returns
An optional containing the parsed uint128_t value if successful, otherwise an empty optional.

◆ from_string() [6/6]

template<typename T , size_t N>
static constexpr inline optional< uint128_t > from_string ( const T(&) str[N],
format fmt = format::decimal )
inlinestaticnoexcept

Parses a string to a uint128_t instance.

This static method attempts to parse a given string as a uint128_t value in the specified format. If the parsing is successful, it returns an optional containing the parsed uint128_t value.

Template Parameters
TThe character type of the array.
NThe size of the character array.
Parameters
[in]strThe input string to parse.
[in]fmtThe string format to interpret the input string (defaults to decimal).
Returns
An optional containing the parsed uint128_t value if successful, otherwise an empty optional.

◆ operator bool()

constexpr inline operator bool ( ) const
inlineexplicitnoexcept

Checks if the uint128_t value is non-zero.

This method allows uint128_t instances to be contextually converted to a boolean to check for non-zero values.

Returns
true if the uint128_t value is non-zero, false otherwise.

◆ operator unsigned long long()

constexpr inline operator unsigned long long ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator long long()

constexpr inline operator long long ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator unsigned long()

constexpr inline operator unsigned long ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator long()

constexpr inline operator long ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator unsigned int()

constexpr inline operator unsigned int ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator int()

constexpr inline operator int ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator unsigned short()

constexpr inline operator unsigned short ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator short()

constexpr inline operator short ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator unsigned char()

constexpr inline operator unsigned char ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator char()

constexpr inline operator char ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator signed char()

constexpr inline operator signed char ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to an integral type.

This method allows for the explicit conversion of a uint128_t value to a specified integral type.

Returns
The uint128_t value cast to the specified integral type.

◆ operator long double()

inline operator long double ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to a floating-point type.

This method allows for the explicit conversion of a uint128_t value to a specified floating-point type.

Returns
The uint128_t value cast to the specified floating-point type.

◆ operator double()

inline operator double ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to a floating-point type.

This method allows for the explicit conversion of a uint128_t value to a specified floating-point type.

Returns
The uint128_t value cast to the specified floating-point type.

◆ operator float()

inline operator float ( ) const
inlineexplicitnoexcept

Casts the uint128_t value to a floating-point type.

This method allows for the explicit conversion of a uint128_t value to a specified floating-point type.

Returns
The uint128_t value cast to the specified floating-point type.

◆ operator+=()

constexpr inline uint128_t & operator+= ( const uint128_t & other)
inlinenoexcept

Addition assignment operator.

Adds the value of another uint128_t instance to this instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to add.
Returns
A reference to this instance after addition.

◆ operator-=()

constexpr inline uint128_t & operator-= ( const uint128_t & other)
inlinenoexcept

Subtraction assignment operator.

Subtracts the value of another uint128_t instance from this instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to subtract.
Returns
A reference to this instance after subtraction.

◆ operator*=()

constexpr inline uint128_t & operator*= ( const uint128_t & other)
inlinenoexcept

Multiplication assignment operator.

Multiplies this instance by another uint128_t instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to multiply by.
Returns
A reference to this instance after multiplication.

◆ operator/=()

constexpr inline uint128_t & operator/= ( const uint128_t & other)
inlinenoexcept

Division assignment operator.

Divides this instance by another uint128_t instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to divide by.
Returns
A reference to this instance after division.

◆ operator%=()

constexpr inline uint128_t & operator%= ( const uint128_t & other)
inlinenoexcept

Remainder assignment operator.

Calculates the remainder of this instance divided by another uint128_t instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to divide by.
Returns
A reference to this instance after calculating the remainder.

◆ operator&=()

constexpr inline uint128_t & operator&= ( const uint128_t & other)
inlinenoexcept

Bitwise AND assignment operator.

Performs a bitwise AND operation between this instance and another uint128_t instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to perform the bitwise AND with.
Returns
A reference to this instance after the bitwise AND operation.

◆ operator|=()

constexpr inline uint128_t & operator|= ( const uint128_t & other)
inlinenoexcept

Bitwise OR assignment operator.

Performs a bitwise OR operation between this instance and another uint128_t instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to perform the bitwise OR with.
Returns
A reference to this instance after the bitwise OR operation.

◆ operator^=()

constexpr inline uint128_t & operator^= ( const uint128_t & other)
inlinenoexcept

Bitwise XOR assignment operator.

Performs a bitwise XOR operation between this instance and another uint128_t instance and assigns the result to this instance.

Parameters
[in]otherThe uint128_t instance to perform the bitwise XOR with.
Returns
A reference to this instance after the bitwise XOR operation.

◆ operator<<=()

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_t & operator<<= ( T shift)
inlinenoexcept

Bitwise left shift assignment operator.

Shifts the bits of this instance to the left by the specified number of places and assigns the result to this instance.

Template Parameters
TAn integral type representing the number of places to shift.
Parameters
[in]shiftThe number of bits to shift to the left.
Returns
A reference to this instance after the shift operation.

◆ operator>>=()

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_t & operator>>= ( T shift)
inlinenoexcept

Bitwise right shift assignment operator.

Shifts the bits of this instance to the right by the specified number of places and assigns the result to this instance.

Template Parameters
TAn integral type representing the number of places to shift.
Parameters
[in]shiftThe number of bits to shift to the right.
Returns
A reference to this instance after the shift operation.

◆ operator+() [1/2]

constexpr inline uint128_t operator+ ( ) const
inlinenoexcept

Unary plus operator.

Returns a new instance of uint128_t with the same value as this instance.

Returns
A new uint128_t instance with the same value.

◆ operator-() [1/2]

constexpr inline uint128_t operator- ( ) const
inlinenoexcept

Unary minus operator.

Returns a new instance of uint128_t representing the two's complement of this instance.

Returns
A new uint128_t instance representing the negated value.

◆ operator~()

constexpr inline uint128_t operator~ ( ) const
inlinenoexcept

Bitwise NOT operator.

Returns a new instance of uint128_t with all the bits of this instance inverted.

Returns
A new uint128_t instance with inverted bits.

◆ operator+() [2/2]

constexpr inline uint128_t operator+ ( const uint128_t & other) const
inlinenoexcept

Addition operator with another uint128_t instance.

Adds the value of another uint128_t instance to this instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to add.
Returns
A new uint128_t instance representing the sum.

◆ operator-() [2/2]

constexpr inline uint128_t operator- ( const uint128_t & other) const
inlinenoexcept

Subtraction operator with another uint128_t instance.

Subtracts the value of another uint128_t instance from this instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to subtract.
Returns
A new uint128_t instance representing the difference.

◆ operator*()

constexpr inline uint128_t operator* ( const uint128_t & other) const
inlinenoexcept

Multiplication operator with another uint128_t instance.

Multiplies this instance by another uint128_t instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to multiply by.
Returns
A new uint128_t instance representing the product.

◆ operator/()

constexpr inline uint128_t operator/ ( const uint128_t & other) const
inlinenoexcept

Division operator with another uint128_t instance.

Divides this instance by another uint128_t instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to divide by.
Returns
A new uint128_t instance representing the quotient.

◆ operator%()

constexpr inline uint128_t operator% ( const uint128_t & other) const
inlinenoexcept

Remainder operator with another uint128_t instance.

Calculates the remainder of this instance divided by another uint128_t instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to divide by.
Returns
A new uint128_t instance representing the remainder.

◆ operator&()

constexpr inline uint128_t operator& ( const uint128_t & other) const
inlinenoexcept

Bitwise AND operator with another uint128_t instance.

Performs a bitwise AND operation between this instance and another uint128_t instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to perform the bitwise AND with.
Returns
A new uint128_t instance representing the result of the bitwise AND operation.

◆ operator|()

constexpr inline uint128_t operator| ( const uint128_t & other) const
inlinenoexcept

Bitwise OR operator with another uint128_t instance.

Performs a bitwise OR operation between this instance and another uint128_t instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to perform the bitwise OR with.
Returns
A new uint128_t instance representing the result of the bitwise OR operation.

◆ operator^()

constexpr inline uint128_t operator^ ( const uint128_t & other) const
inlinenoexcept

Bitwise XOR operator with another uint128_t instance.

Performs a bitwise XOR operation between this instance and another uint128_t instance and returns a new uint128_t instance with the result.

Parameters
[in]otherThe uint128_t instance to perform the bitwise XOR with.
Returns
A new uint128_t instance representing the result of the bitwise XOR operation.

◆ operator<<()

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_t operator<< ( T shift) const
inlinenoexcept

Bitwise left shift operator with an integral type.

Shifts the bits of this instance to the left by the specified number of places and returns a new uint128_t instance with the result.

Template Parameters
TAn integral type representing the number of places to shift.
Parameters
[in]shiftThe number of bits to shift to the left.
Returns
A new uint128_t instance representing the result of the left shift operation.

◆ operator>>()

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline uint128_t operator>> ( T shift) const
inlinenoexcept

Bitwise right shift operator with an integral type.

Shifts the bits of this instance to the right by the specified number of places and returns a new uint128_t instance with the result.

Template Parameters
TAn integral type representing the number of places to shift.
Parameters
[in]shiftThe number of bits to shift to the right.
Returns
A new uint128_t instance representing the result of the right shift operation.

◆ operator++() [1/2]

constexpr inline uint128_t & operator++ ( )
inlinenoexcept

Pre-increment operator.

Increments this instance by one and returns a reference to this instance.

Returns
A reference to this instance after the increment.

◆ operator--() [1/2]

constexpr inline uint128_t & operator-- ( )
inlinenoexcept

Pre-decrement operator.

Decrements this instance by one and returns a reference to this instance.

Returns
A reference to this instance after the decrement.

◆ operator++() [2/2]

constexpr inline uint128_t operator++ ( int )
inlinenoexcept

Post-increment operator.

Increments this instance by one and returns the value of the instance before the increment.

Returns
The value of this instance before the increment.

◆ operator--() [2/2]

constexpr inline uint128_t operator-- ( int )
inlinenoexcept

Post-decrement operator.

Decrements this instance by one and returns the value of the instance before the decrement.

Returns
The value of this instance before the decrement.

◆ operator!()

constexpr inline bool operator! ( ) const
inlinenoexcept

Logical NOT operator.

Returns true if this instance is zero, otherwise returns false.

Returns
true if this instance is zero, false otherwise.

◆ operator&&()

constexpr inline bool operator&& ( const uint128_t & other) const
inlinenoexcept

Logical AND operator.

Returns true if both this instance and another uint128_t instance are non-zero, otherwise returns false.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if both instances are non-zero, false otherwise.

◆ operator||()

constexpr inline bool operator|| ( const uint128_t & other) const
inlinenoexcept

Logical OR operator.

Returns true if either this instance or another uint128_t instance is non-zero, otherwise returns false.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if either instance is non-zero, false otherwise.

◆ operator==() [1/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator== ( T lower) const
inlinenoexcept

Equality operator with an integral type.

Compares this instance to an integral value for equality.

Template Parameters
TAn integral type to compare with.
Parameters
[in]lowerThe integral value to compare with.
Returns
true if this instance is equal to the integral value, false otherwise.

◆ operator==() [2/2]

constexpr inline bool operator== ( const uint128_t & other) const
inlinenoexcept

Equality operator with another uint128_t instance.

Compares this instance to another uint128_t instance for equality.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if this instance is equal to the other instance, false otherwise.

◆ operator!=() [1/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator!= ( T lower) const
inlinenoexcept

Inequality operator with an integral type.

Compares this instance to an integral value for inequality.

Template Parameters
TAn integral type to compare with.
Parameters
[in]lowerThe integral value to compare with.
Returns
true if this instance is not equal to the integral value, false otherwise.

◆ operator!=() [2/2]

constexpr inline bool operator!= ( const uint128_t & other) const
inlinenoexcept

Inequality operator with another uint128_t instance.

Compares this instance to another uint128_t instance for inequality.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if this instance is not equal to the other instance, false otherwise.

◆ operator<() [1/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator< ( T lower) const
inlinenoexcept

Less than operator with an integral type.

Checks if the value of this instance is lexicographically less than the provided integral value.

Template Parameters
TAn integral type to compare with.
Parameters
[in]lowerThe integral value to compare with.
Returns
true if this instance is less than the integral value, false otherwise.

◆ operator<() [2/2]

constexpr inline bool operator< ( const uint128_t & other) const
inlinenoexcept

Less than operator with another uint128_t instance.

Checks if the value of this instance is lexicographically less than the provided uint128_t instance.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if this instance is less than the other instance, false otherwise.

◆ operator>() [1/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator> ( T lower) const
inlinenoexcept

Greater than operator with an integral type.

Checks if the value of this instance is lexicographically greater than the provided integral value.

Template Parameters
TAn integral type to compare with.
Parameters
[in]lowerThe integral value to compare with.
Returns
true if this instance is greater than the integral value, false otherwise.

◆ operator>() [2/2]

constexpr inline bool operator> ( const uint128_t & other) const
inlinenoexcept

Greater than operator with another uint128_t instance.

Checks if the value of this instance is lexicographically greater than the provided uint128_t instance.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if this instance is greater than the other instance, false otherwise.

◆ operator<=() [1/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator<= ( T lower) const
inlinenoexcept

Less than or equal to operator with an integral type.

Checks if the value of this instance is lexicographically less than or equal to the provided integral value.

Template Parameters
TAn integral type to compare with.
Parameters
[in]lowerThe integral value to compare with.
Returns
true if this instance is less than or equal to the integral value, false otherwise.

◆ operator<=() [2/2]

constexpr inline bool operator<= ( const uint128_t & other) const
inlinenoexcept

Less than or equal to operator with another uint128_t instance.

Checks if the value of this instance is lexicographically less than or equal to the provided uint128_t instance.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if this instance is less than or equal to the other instance, false otherwise.

◆ operator>=() [1/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
constexpr inline bool operator>= ( T lower) const
inlinenoexcept

Greater than or equal to operator with an integral type.

Checks if the value of this instance is lexicographically greater than or equal to the provided integral value.

Template Parameters
TAn integral type to compare with.
Parameters
[in]lowerThe integral value to compare with.
Returns
true if this instance is greater than or equal to the integral value, false otherwise.

◆ operator>=() [2/2]

constexpr inline bool operator>= ( const uint128_t & other) const
inlinenoexcept

Greater than or equal to operator with another uint128_t instance.

Checks if the value of this instance is lexicographically greater than or equal to the provided uint128_t instance.

Parameters
[in]otherThe uint128_t instance to compare with.
Returns
true if this instance is greater than or equal to the other instance, false otherwise.

The documentation for this class was generated from the following file: