TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
class for 256-bit unsigned integer More...
#include <uint256_t.hpp>
Public Member Functions | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t (T low) | |
Parameterized constructor. | |
uint256_t (const std::string &str) | |
Parameterized constructor. | |
uint256_t (const uint256_t &num)=default | |
Copy constructor. | |
uint256_t (uint256_t &&num) noexcept | |
Move constructor. | |
uint256_t (uint128_t high, uint128_t low) | |
Parameterized constructor. | |
uint256_t (const uint64_t high, const uint64_t low) | |
Parameterized constructor. | |
~uint256_t ()=default | |
Destructor for uint256_t. | |
uint32_t | _lez () |
Leading zeroes in binary. | |
uint32_t | _trz () |
Trailing zeroes in binary. | |
operator bool () const | |
casting operator to boolean value | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
operator T () const | |
casting operator to any integer value | |
operator uint128_t () const | |
casting operator to uint128_t | |
uint128_t | lower () const |
returns lower 128-bit integer part | |
uint128_t | upper () const |
returns upper 128-bit integer part | |
uint256_t & | operator= (const uint256_t &p)=default |
operator = for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator= (const T &p) |
operator = for other types | |
uint256_t & | operator= (const std::string &p) |
operator = for type string | |
uint256_t & | operator= (uint256_t &&p)=default |
Move assignment operator. | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator+ (const T &p) |
operator + for uint256_t and other integer types. | |
uint256_t | operator+ (const uint256_t &p) |
operator + for uint256_t and other integer types. | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator+= (const T &p) |
operator += for uint256_t and other integer types. | |
uint256_t & | operator+= (const uint256_t &p) |
operator += for uint256_t | |
uint256_t & | operator++ () |
pre-increment operator | |
uint256_t | operator++ (int) |
post-increment operator | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator- (const T &p) |
operator - for uint256_t and other integer types. | |
uint256_t | operator- (const uint256_t &p) |
operator - for uint256_t | |
uint256_t | operator- () |
operator - using twos complement | |
uint256_t & | operator-- () |
operator – (pre-decrement) | |
uint256_t | operator-- (int p) |
operator – (post-decrement) | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator-= (const T p) |
operator -= for uint256_t and other integer types. | |
uint256_t & | operator-= (const uint256_t &p) |
operator -= for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator* (const T &p) |
operator * for uint256_t and other integer types. | |
uint256_t | operator* (const uint256_t &p) |
operator * for uint256_t and other integer types. | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator*= (const T &p) |
operator *= for uint256_t and other integer types. | |
uint256_t & | operator*= (const uint256_t &p) |
operator *= for uint256_t and other integer types. | |
std::pair< uint256_t, uint256_t > | divide (const uint256_t &p) |
divide function for uint256_t and other integer types. | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator/ (const T &p) |
operator / for uint256_t and other integer types. | |
uint256_t | operator/ (const uint256_t &p) |
operator / for uint256_t and other integer types. | |
uint256_t & | operator/= (const uint256_t &p) |
operator /= for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator/= (const T &p) |
operator /= for uint256_t and other integer types. | |
uint256_t | operator% (const uint256_t &p) |
operator % for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator% (const T &p) |
operator % for uint256_t and other integer types. | |
uint256_t & | operator%= (const uint256_t &p) |
operator %= for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator%= (const T &p) |
operator %= for uint256_t | |
bool | operator< (const uint256_t &other) |
operator < for uint256_t | |
bool | operator<= (const uint256_t &other) |
operator <= for uint256_t | |
bool | operator> (const uint256_t &other) |
operator > for uint256_t | |
bool | operator>= (const uint256_t &other) |
operator >= for uint256_t | |
bool | operator== (const uint256_t &other) |
operator == for uint256_t | |
bool | operator!= (const uint256_t &other) |
operator != for uint256_t | |
bool | operator! () |
operator ! for uint256_t | |
bool | operator&& (const uint256_t &b) |
operator && for uint256_t | |
bool | operator|| (const uint256_t &b) |
operator || for uint256_t | |
bool | operator() () |
operator () for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator< (const T &other) |
operator < for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator<= (const T &other) |
operator <= for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator> (const T &other) |
operator > for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator>= (const T &other) |
operator >= for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator== (const T &other) |
operator == for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator!= (const T &other) |
operator != for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator&& (const T &b) |
operator && for other types | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
bool | operator|| (const T &b) |
operator || for other types | |
uint256_t | operator~ () |
operator ~ for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator<< (const T &p) |
operator << for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator<<= (const T &p) |
operator <<= for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator>> (const T &p) |
operator >> for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator>>= (const T &p) |
operator >>= for uint256_t | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator& (const T &p) |
operator & for other types (bitwise operator) | |
uint256_t | operator& (const uint256_t &p) |
operator & for uint256_t (bitwise operator) | |
uint256_t & | operator&= (const uint256_t &p) |
operator &= for uint256_t (bitwise operator) | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator&= (const T p) |
operator &= for other types (bitwise operator) | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator| (const T &p) |
operator | for other types (bitwise operator) | |
uint256_t | operator| (const uint256_t &p) |
operator | for uint256_t (bitwise operator) | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator|= (const T &p) |
operator |= for other types (bitwise operator) | |
uint256_t & | operator|= (const uint256_t &p) |
operator |= for uint256_t (bitwise operator) | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t | operator^ (const T &p) |
operator ^ for other types (bitwise operator) | |
uint256_t | operator^ (const uint256_t &p) |
operator ^ for uint256_t (bitwise operator) | |
uint256_t & | operator^= (const uint256_t &p) |
operator ^= for uint256_t (bitwise operator) | |
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value, T>::type> | |
uint256_t & | operator^= (const T &p) |
operator ^= for other types (bitwise operator) | |
Private Member Functions | |
void | __get_integer_from_string (const std::string &str) |
First and second half of 256 bit number. | |
Private Attributes | |
uint128_t | f {} |
uint128_t | s {} |
Friends | |
std::ostream & | operator<< (std::ostream &op, uint256_t p) |
operator << for printing uint256_t integer | |
class for 256-bit unsigned integer
Definition at line 33 of file uint256_t.hpp.
|
inlineexplicit |
Parameterized constructor.
T | template for integer types |
low | Integer denoting lower 128-bits |
Definition at line 75 of file uint256_t.hpp.
|
inlineexplicit |
Parameterized constructor.
str | Integer string (hexadecimal starting with 0x.. or decimal) |
Definition at line 81 of file uint256_t.hpp.
|
default |
Copy constructor.
num | 256-bit unsigned integer |
|
inlinenoexcept |
Move constructor.
num | 256-bit unsigned integer |
Definition at line 95 of file uint256_t.hpp.
Parameterized constructor.
high | higher part 128-bit unsigned integer |
low | lower part 128-bit unsigned integer |
Definition at line 103 of file uint256_t.hpp.
|
inline |
Parameterized constructor.
high | higher part 64-bit unsigned integer |
low | lower part 64-bit unsigned integer |
Definition at line 111 of file uint256_t.hpp.
|
inlineprivate |
First and second half of 256 bit number.
Get integer from given string.
Create an integer from a given string
str | integer string, can be hexadecimal (starting on 0x... or number) |
Definition at line 43 of file uint256_t.hpp.
|
inline |
Leading zeroes in binary.
Calculates leading zeros in 256-bit integer
Definition at line 123 of file uint256_t.hpp.
|
inline |
Trailing zeroes in binary.
Calculates leading zeros in 256-bit integer
Definition at line 135 of file uint256_t.hpp.
divide function for uint256_t and other integer types.
divide this value and
p | 256-bit unsigned integer |
Definition at line 421 of file uint256_t.hpp.
|
inline |
returns lower 128-bit integer part
Definition at line 169 of file uint256_t.hpp.
|
inlineexplicit |
casting operator to boolean value
Definition at line 146 of file uint256_t.hpp.
|
inlineexplicit |
casting operator to any integer value
T | any integer type |
Definition at line 155 of file uint256_t.hpp.
|
inlineexplicit |
casting operator to uint128_t
Definition at line 163 of file uint256_t.hpp.
|
inline |
operator ! for uint256_t
Definition at line 596 of file uint256_t.hpp.
|
inline |
operator != for other types
T | integral type |
other | number to be compared with this |
Definition at line 690 of file uint256_t.hpp.
|
inline |
operator != for uint256_t
other | number to be compared with this |
Definition at line 588 of file uint256_t.hpp.
|
inline |
operator % for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 509 of file uint256_t.hpp.
operator % for uint256_t
p | 256-bit unsigned integer |
Definition at line 499 of file uint256_t.hpp.
|
inline |
operator %= for uint256_t
T | denoting integral type |
p | a type of integer variable |
Definition at line 533 of file uint256_t.hpp.
operator %= for uint256_t
p | 256-bit unsigned integer |
Definition at line 520 of file uint256_t.hpp.
|
inline |
operator & for other types (bitwise operator)
T | integral type |
p | number to be operated |
Definition at line 811 of file uint256_t.hpp.
operator & for uint256_t (bitwise operator)
p | number to be operated |
Definition at line 820 of file uint256_t.hpp.
|
inline |
operator && for other types
T | integral type |
other | number to be compared with this |
Definition at line 702 of file uint256_t.hpp.
|
inline |
operator && for uint256_t
b | number to be compared with this |
Definition at line 603 of file uint256_t.hpp.
|
inline |
operator &= for other types (bitwise operator)
T | integral type |
p | number to be operated |
Definition at line 843 of file uint256_t.hpp.
operator &= for uint256_t (bitwise operator)
p | number to be operated |
Definition at line 829 of file uint256_t.hpp.
|
inline |
operator () for uint256_t
Definition at line 620 of file uint256_t.hpp.
|
inline |
operator * for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 362 of file uint256_t.hpp.
operator * for uint256_t and other integer types.
p | 256-bit unsigned integer |
Definition at line 371 of file uint256_t.hpp.
|
inline |
operator *= for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 392 of file uint256_t.hpp.
operator *= for uint256_t and other integer types.
p | 256-bit unsigned integer |
Definition at line 401 of file uint256_t.hpp.
|
inline |
operator + for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 220 of file uint256_t.hpp.
operator + for uint256_t and other integer types.
p | 256-bit unsigned integer |
Definition at line 230 of file uint256_t.hpp.
|
inline |
pre-increment operator
Definition at line 266 of file uint256_t.hpp.
|
inline |
post-increment operator
Definition at line 275 of file uint256_t.hpp.
|
inline |
operator += for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 243 of file uint256_t.hpp.
operator += for uint256_t
p | 256-bit unsigned integer |
Definition at line 255 of file uint256_t.hpp.
|
inline |
operator - using twos complement
Definition at line 307 of file uint256_t.hpp.
|
inline |
operator - for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 288 of file uint256_t.hpp.
operator - for uint256_t
p | a type of integer variable |
Definition at line 298 of file uint256_t.hpp.
|
inline |
operator – (pre-decrement)
Definition at line 313 of file uint256_t.hpp.
|
inline |
operator – (post-decrement)
Definition at line 322 of file uint256_t.hpp.
|
inline |
operator -= for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 335 of file uint256_t.hpp.
operator -= for uint256_t
p | 256-bit unsigned integer |
Definition at line 347 of file uint256_t.hpp.
|
inline |
operator / for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 458 of file uint256_t.hpp.
operator / for uint256_t and other integer types.
p | 256-bit unsigned integer |
Definition at line 469 of file uint256_t.hpp.
|
inline |
operator /= for uint256_t and other integer types.
T | denoting integral type |
p | a type of integer variable |
Definition at line 489 of file uint256_t.hpp.
operator /= for uint256_t
p | 256-bit unsigned integer |
Definition at line 476 of file uint256_t.hpp.
|
inline |
operator < for other types
T | integral type |
other | number to be compared with this |
Definition at line 630 of file uint256_t.hpp.
|
inline |
operator < for uint256_t
other | number to be compared with this |
Definition at line 543 of file uint256_t.hpp.
|
inline |
operator << for uint256_t
T | integral type |
p | number denoting number of shifts |
Definition at line 733 of file uint256_t.hpp.
|
inline |
operator <<= for uint256_t
T | integral type |
p | number denoting number of shifts |
Definition at line 751 of file uint256_t.hpp.
|
inline |
operator <= for other types
T | integral type |
other | number to be compared with this |
Definition at line 642 of file uint256_t.hpp.
|
inline |
operator <= for uint256_t
other | number to be compared with this |
Definition at line 552 of file uint256_t.hpp.
|
inline |
operator = for type string
p | a string to assign it's value to equivalent integer |
p
Definition at line 202 of file uint256_t.hpp.
|
inline |
operator = for other types
T | denoting any integer type |
p | an integer to assign it's value |
p
Definition at line 192 of file uint256_t.hpp.
operator = for uint256_t
p | an 256-bit integer to assign it's value |
p
|
inline |
operator == for other types
T | integral type |
other | number to be compared with this |
Definition at line 678 of file uint256_t.hpp.
|
inline |
operator == for uint256_t
other | number to be compared with this |
Definition at line 579 of file uint256_t.hpp.
|
inline |
operator > for other types
T | integral type |
other | number to be compared with this |
Definition at line 654 of file uint256_t.hpp.
|
inline |
operator > for uint256_t
other | number to be compared with this |
Definition at line 561 of file uint256_t.hpp.
|
inline |
operator >= for other types
T | integral type |
other | number to be compared with this |
Definition at line 666 of file uint256_t.hpp.
|
inline |
operator >= for uint256_t
other | number to be compared with this |
Definition at line 570 of file uint256_t.hpp.
|
inline |
operator >> for uint256_t
T | integral type |
p | number denoting number of shifts |
Definition at line 772 of file uint256_t.hpp.
|
inline |
operator >>= for uint256_t
T | integral type |
p | number denoting number of shifts |
Definition at line 790 of file uint256_t.hpp.
|
inline |
operator ^ for other types (bitwise operator)
T | integral type |
p | number to be operated |
Definition at line 901 of file uint256_t.hpp.
operator ^ for uint256_t (bitwise operator)
p | number to be operated |
Definition at line 910 of file uint256_t.hpp.
|
inline |
operator ^= for other types (bitwise operator)
T | integral type |
p | number to be operated |
Definition at line 933 of file uint256_t.hpp.
operator ^= for uint256_t (bitwise operator)
p | number to be operated |
Definition at line 919 of file uint256_t.hpp.
|
inline |
operator | for other types (bitwise operator)
T | integral type |
p | number to be operated |
Definition at line 856 of file uint256_t.hpp.
operator | for uint256_t (bitwise operator)
p | number to be operated |
Definition at line 865 of file uint256_t.hpp.
|
inline |
operator |= for other types (bitwise operator)
T | integral type |
p | number to be operated |
Definition at line 877 of file uint256_t.hpp.
operator |= for uint256_t (bitwise operator)
p | number to be operated |
Definition at line 887 of file uint256_t.hpp.
|
inline |
operator || for other types
T | integral type |
other | number to be compared with this |
Definition at line 715 of file uint256_t.hpp.
|
inline |
operator || for uint256_t
b | number to be compared with this |
Definition at line 612 of file uint256_t.hpp.
|
inline |
operator ~ for uint256_t
Definition at line 723 of file uint256_t.hpp.
|
inline |
returns upper 128-bit integer part
Definition at line 175 of file uint256_t.hpp.
|
friend |
operator << for printing uint256_t integer
Prints the uint256_t integer in decimal form
op | ostream object |
p | 256-bit integer |
Definition at line 947 of file uint256_t.hpp.
|
private |
Definition at line 34 of file uint256_t.hpp.
|
private |
Definition at line 34 of file uint256_t.hpp.