![]() |
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) |
| 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 24 of file uint256_t.hpp.
|
inlineexplicit |
Parameterized constructor.
| T | template for integer types |
| low | Integer denoting lower 128-bits |
Definition at line 66 of file uint256_t.hpp.
|
inlineexplicit |
Parameterized constructor.
| str | Integer string (hexadecimal starting with 0x.. or decimal) |
Definition at line 72 of file uint256_t.hpp.
|
default |
Copy constructor.
| num | 256-bit unsigned integer |
|
inlinenoexcept |
Move constructor.
| num | 256-bit unsigned integer |
Definition at line 86 of file uint256_t.hpp.
Parameterized constructor.
| high | higher part 128-bit unsigned integer |
| low | lower part 128-bit unsigned integer |
Definition at line 94 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 102 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 34 of file uint256_t.hpp.
|
inline |
Leading zeroes in binary.
Calculates leading zeros in 256-bit integer
Definition at line 114 of file uint256_t.hpp.
|
inline |
Trailing zeroes in binary.
Calculates leading zeros in 256-bit integer
Definition at line 126 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 412 of file uint256_t.hpp.
|
inline |
returns lower 128-bit integer part
Definition at line 160 of file uint256_t.hpp.
|
inlineexplicit |
casting operator to boolean value
Definition at line 137 of file uint256_t.hpp.
|
inlineexplicit |
casting operator to any integer value
| T | any integer type |
Definition at line 146 of file uint256_t.hpp.
|
inlineexplicit |
casting operator to uint128_t
Definition at line 154 of file uint256_t.hpp.
|
inline |
operator ! for uint256_t
Definition at line 587 of file uint256_t.hpp.
|
inline |
operator != for other types
| T | integral type |
| other | number to be compared with this |
Definition at line 681 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 uint256_t and other integer types.
| T | denoting integral type |
| p | a type of integer variable |
Definition at line 500 of file uint256_t.hpp.
operator % for uint256_t
| p | 256-bit unsigned integer |
Definition at line 490 of file uint256_t.hpp.
|
inline |
operator %= for uint256_t
| T | denoting integral type |
| p | a type of integer variable |
Definition at line 524 of file uint256_t.hpp.
operator %= for uint256_t
| p | 256-bit unsigned integer |
Definition at line 511 of file uint256_t.hpp.
|
inline |
operator & for other types (bitwise operator)
| T | integral type |
| p | number to be operated |
Definition at line 802 of file uint256_t.hpp.
operator & for uint256_t (bitwise operator)
| p | number to be operated |
Definition at line 811 of file uint256_t.hpp.
|
inline |
operator && for other types
| T | integral type |
| other | number to be compared with this |
Definition at line 693 of file uint256_t.hpp.
|
inline |
operator && for uint256_t
| b | number to be compared with this |
Definition at line 594 of file uint256_t.hpp.
|
inline |
operator &= for other types (bitwise operator)
| T | integral type |
| p | number to be operated |
Definition at line 834 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 uint256_t
Definition at line 611 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 353 of file uint256_t.hpp.
operator * for uint256_t and other integer types.
| p | 256-bit unsigned integer |
Definition at line 362 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 383 of file uint256_t.hpp.
operator *= for uint256_t and other integer types.
| p | 256-bit unsigned integer |
Definition at line 392 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 211 of file uint256_t.hpp.
operator + for uint256_t and other integer types.
| p | 256-bit unsigned integer |
Definition at line 221 of file uint256_t.hpp.
|
inline |
pre-increment operator
Definition at line 257 of file uint256_t.hpp.
|
inline |
post-increment operator
Definition at line 266 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 234 of file uint256_t.hpp.
operator += for uint256_t
| p | 256-bit unsigned integer |
Definition at line 246 of file uint256_t.hpp.
|
inline |
operator - using twos complement
Definition at line 298 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 279 of file uint256_t.hpp.
operator - for uint256_t
| p | a type of integer variable |
Definition at line 289 of file uint256_t.hpp.
|
inline |
operator – (pre-decrement)
Definition at line 304 of file uint256_t.hpp.
|
inline |
operator – (post-decrement)
Definition at line 313 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 326 of file uint256_t.hpp.
operator -= for uint256_t
| p | 256-bit unsigned integer |
Definition at line 338 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 449 of file uint256_t.hpp.
operator / for uint256_t and other integer types.
| p | 256-bit unsigned integer |
Definition at line 460 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 480 of file uint256_t.hpp.
operator /= for uint256_t
| p | 256-bit unsigned integer |
Definition at line 467 of file uint256_t.hpp.
|
inline |
operator < for other types
| T | integral type |
| other | number to be compared with this |
Definition at line 621 of file uint256_t.hpp.
|
inline |
operator < for uint256_t
| other | number to be compared with this |
Definition at line 534 of file uint256_t.hpp.
|
inline |
operator << for uint256_t
| T | integral type |
| p | number denoting number of shifts |
Definition at line 724 of file uint256_t.hpp.
|
inline |
operator <<= for uint256_t
| T | integral type |
| p | number denoting number of shifts |
Definition at line 742 of file uint256_t.hpp.
|
inline |
operator <= for other types
| T | integral type |
| other | number to be compared with this |
Definition at line 633 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 type string
| p | a string to assign it's value to equivalent integer |
Definition at line 193 of file uint256_t.hpp.
|
inline |
operator = for other types
| T | denoting any integer type |
| p | an integer to assign it's value |
Definition at line 183 of file uint256_t.hpp.
operator = for uint256_t
| p | an 256-bit integer to assign it's value |
|
inline |
operator == for other types
| T | integral type |
| other | number to be compared with this |
Definition at line 669 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 other types
| T | integral type |
| other | number to be compared with this |
Definition at line 645 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 other types
| T | integral type |
| other | number to be compared with this |
Definition at line 657 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 uint256_t
| T | integral type |
| p | number denoting number of shifts |
Definition at line 763 of file uint256_t.hpp.
|
inline |
operator >>= for uint256_t
| T | integral type |
| p | number denoting number of shifts |
Definition at line 781 of file uint256_t.hpp.
|
inline |
operator ^ for other types (bitwise operator)
| T | integral type |
| p | number to be operated |
Definition at line 892 of file uint256_t.hpp.
operator ^ for uint256_t (bitwise operator)
| p | number to be operated |
Definition at line 901 of file uint256_t.hpp.
|
inline |
operator ^= for other types (bitwise operator)
| T | integral type |
| p | number to be operated |
Definition at line 924 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 847 of file uint256_t.hpp.
operator | for uint256_t (bitwise operator)
| p | number to be operated |
Definition at line 856 of file uint256_t.hpp.
|
inline |
operator |= for other types (bitwise operator)
| T | integral type |
| p | number to be operated |
Definition at line 868 of file uint256_t.hpp.
operator |= for uint256_t (bitwise operator)
| p | number to be operated |
Definition at line 878 of file uint256_t.hpp.
|
inline |
operator || for other types
| T | integral type |
| other | number to be compared with this |
Definition at line 706 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 uint256_t
Definition at line 714 of file uint256_t.hpp.
|
inline |
returns upper 128-bit integer part
Definition at line 166 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 938 of file uint256_t.hpp.
|
private |
Definition at line 25 of file uint256_t.hpp.
|
private |
Definition at line 25 of file uint256_t.hpp.