TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
Loading...
Searching...
No Matches
uint256_t.hpp
Go to the documentation of this file.
1
10#include <string>
11#include <utility>
12
13#include "uint128_t.hpp"
14
15#ifndef CIPHERS_UINT256_T_HPP_
16#define CIPHERS_UINT256_T_HPP_
17
18class uint256_t;
19
20template <>
21struct std::is_integral<uint256_t> : std::true_type {};
22
23template <>
24struct std::is_arithmetic<uint256_t> : std::true_type {};
25
26template <>
27struct std::is_unsigned<uint256_t> : std::true_type {};
28
33class uint256_t {
34 uint128_t f{}, s{};
35
43 void __get_integer_from_string(const std::string &str) {
44 this->f = this->s = uint128_t(0);
45 if (str.size() > 1 && str[1] == 'x') {
46 for (auto i = 2; i < str.size(); ++i) {
47 *this *= 16LL;
48 if (str[i] >= '0' && str[i] <= '9') {
49 *this += (str[i] - '0');
50 } else if (str[i] >= 'A' && str[i] <= 'F') {
51 *this += (str[i] - 'A' + 10);
52 } else if (str[i] >= 'a' && str[i] <= 'f') {
53 *this += (str[i] - 'a' + 10);
54 }
55 }
56 } else {
57 for (auto &x : str) {
58 *this *= 10LL;
59 *this += (x - '0');
60 }
61 }
62 }
63
64 public:
65 // Constructors
66 uint256_t() = default;
67
73 template <typename T, typename = typename std::enable_if<
74 std::is_integral<T>::value, T>::type>
75 explicit uint256_t(T low) : s(low), f(0) {}
76
81 explicit uint256_t(const std::string &str) {
83 }
84
89 uint256_t(const uint256_t &num) = default;
90
95 uint256_t(uint256_t &&num) noexcept
96 : f(std::move(num.f)), s(std::move(num.s)) {}
97
104 : f(std::move(high)), s(std::move(low)) {}
105
111 uint256_t(const uint64_t high, const uint64_t low) : f(high), s(low) {}
112
116 ~uint256_t() = default;
117
123 inline uint32_t _lez() {
124 if (f) {
125 return f._lez();
126 }
127 return 128 + s._lez();
128 }
129
135 inline uint32_t _trz() {
136 if (s) {
137 return s._trz();
138 }
139 return 128 + f._trz();
140 }
141
146 inline explicit operator bool() const { return f || s; }
147
153 template <typename T, typename = typename std::enable_if<
154 std::is_integral<T>::value, T>::type>
155 inline explicit operator T() const {
156 return static_cast<T>(s);
157 }
158
163 inline explicit operator uint128_t() const { return s; }
164
169 inline uint128_t lower() const { return s; }
170
175 inline uint128_t upper() const { return f; }
176
182 inline uint256_t &operator=(const uint256_t &p) = default;
183
190 template <typename T, typename = typename std::enable_if<
191 std::is_integral<T>::value, T>::type>
192 inline uint256_t &operator=(const T &p) {
193 this->s = p;
194 return *this;
195 }
196
202 inline uint256_t &operator=(const std::string &p) {
204 return *this;
205 }
206
210 inline uint256_t &operator=(uint256_t &&p) = default;
211
218 template <typename T, typename = typename std::enable_if<
219 std::is_integral<T>::value, T>::type>
220 inline uint256_t operator+(const T &p) {
221 bool app = s + p < s;
222 return uint256_t(f + app, s + p);
223 }
224
230 inline uint256_t operator+(const uint256_t &p) {
231 bool app = (s + p.s < s);
232 return {f + app + p.f, s + p.s};
233 }
234
241 template <typename T, typename = typename std::enable_if<
242 std::is_integral<T>::value, T>::type>
243 inline uint256_t &operator+=(const T &p) {
244 bool app = (p + s < s);
245 this->f += app;
246 this->s += p;
247 return *this;
248 }
249
255 inline uint256_t &operator+=(const uint256_t &p) {
256 bool app = (s + p.s < s);
257 f = f + app + p.f;
258 s = s + p.s;
259 return *this;
260 }
261
267 *this += 1;
268 return *this;
269 }
270
275 inline uint256_t operator++(int) {
276 ++*this;
277 return *this;
278 }
279
286 template <typename T, typename = typename std::enable_if<
287 std::is_integral<T>::value, T>::type>
288 inline uint256_t operator-(const T &p) {
289 bool app = (p > s);
290 return uint256_t(f - app, s - p);
291 }
292
298 inline uint256_t operator-(const uint256_t &p) {
299 bool app = s < p.s;
300 return {f - p.f - app, s - p.s};
301 }
302
307 inline uint256_t operator-() { return ~*this + uint256_t(1); }
308
314 *this -= 1;
315 return *this;
316 }
317
322 inline uint256_t operator--(int p) {
323 --*this;
324 return *this;
325 }
326
333 template <typename T, typename = typename std::enable_if<
334 std::is_integral<T>::value, T>::type>
335 inline uint256_t operator-=(const T p) {
336 bool app = (p > s);
337 f = f - app;
338 s = s - p;
339 return *this;
340 }
341
347 inline uint256_t &operator-=(const uint256_t &p) {
348 bool app = s < p.s;
349 f = f - app - p.f;
350 s = s - p.s;
351 return *this;
352 }
353
360 template <typename T, typename = typename std::enable_if<
361 std::is_integral<T>::value, T>::type>
362 inline uint256_t operator*(const T &p) {
363 return *this * uint256_t(p);
364 }
365
372 uint128_t f_first(s.upper()), f_second(s.lower()), s_first(p.s.upper()),
373 s_second(p.s.lower());
374 uint128_t fi = f_first * s_first, se = f_first * s_second,
375 th = s_first * f_second, fo = s_second * f_second;
376 uint128_t tmp = se << 64, tmp2 = th << 64;
377 int cc = (tmp + tmp2 < tmp);
378 tmp += tmp2;
379 cc += (tmp + fo < tmp);
380 return {f * p.s + s * p.f + fi + se.upper() + th.upper() + cc,
381 tmp + fo};
382 }
383
390 template <typename T, typename = typename std::enable_if<
391 std::is_integral<T>::value, T>::type>
392 inline uint256_t &operator*=(const T &p) {
393 return (*this *= uint256_t(p));
394 }
395
402 uint128_t f_first(s.upper()), f_second(s.lower()), s_first(p.s.upper()),
403 s_second(p.s.lower());
404 uint128_t fi = f_first * s_first, se = f_first * s_second,
405 th = s_first * f_second, fo = s_second * f_second;
406 uint128_t tmp = se << 64, tmp2 = th << 64;
407 int cc = (tmp + tmp2 < tmp);
408 tmp += tmp2;
409 cc += (tmp + fo < tmp);
410 f = f * p.s + s * p.f + fi + se.upper() + th.upper() + cc;
411 s = tmp + fo;
412 return *this;
413 }
414
421 std::pair<uint256_t, uint256_t> divide(const uint256_t &p) {
422 if (*this < p) { // if this is less than divisor
423 return {uint256_t(0), *this};
424 } else if (*this == p) { // if this is equal to divisor
425 return {uint256_t(1), uint256_t(0)};
426 }
427 uint256_t tmp = p, tmp2 = *this;
428 uint16_t left = tmp._lez() - _lez();
429 tmp <<= left;
430 uint256_t quotient(0);
431 uint256_t zero(0);
432 while (tmp2 >= p) {
433 uint16_t shf = tmp2._lez() - tmp._lez();
434 if (shf) {
435 tmp >>= shf;
436 quotient <<= shf;
437 left -= shf;
438 }
439 if (tmp2 < tmp) {
440 tmp >>= 1;
441 quotient <<= 1;
442 --left;
443 }
444 tmp2 -= tmp;
445 ++quotient;
446 }
447 return {quotient << left, tmp2};
448 }
449
456 template <typename T, typename = typename std::enable_if<
457 std::is_integral<T>::value, T>::type>
458 inline uint256_t operator/(const T &p) {
459 uint256_t tmp = *this;
460 tmp /= uint256_t(p);
461 return tmp;
462 }
463
469 inline uint256_t operator/(const uint256_t &p) { return divide(p).first; }
470
476 inline uint256_t &operator/=(const uint256_t &p) {
477 *this = divide(p).first;
478 return *this;
479 }
480
487 template <typename T, typename = typename std::enable_if<
488 std::is_integral<T>::value, T>::type>
489 inline uint256_t &operator/=(const T &p) {
490 *this /= uint256_t(p);
491 return *this;
492 }
493
499 inline uint256_t operator%(const uint256_t &p) { return divide(p).second; }
500
507 template <typename T, typename = typename std::enable_if<
508 std::is_integral<T>::value, T>::type>
509 inline uint256_t operator%(const T &p) {
510 uint256_t tmp = *this;
511 tmp %= uint256_t(p);
512 return tmp;
513 }
514
520 inline uint256_t &operator%=(const uint256_t &p) {
521 *this = divide(p).second;
522 return *this;
523 }
524
531 template <typename T, typename = typename std::enable_if<
532 std::is_integral<T>::value, T>::type>
533 inline uint256_t &operator%=(const T &p) {
534 *this %= uint256_t(p);
535 return *this;
536 }
537
543 inline bool operator<(const uint256_t &other) {
544 return f < other.f || (f == other.f && s < other.s);
545 }
546
552 inline bool operator<=(const uint256_t &other) {
553 return f < other.f || (f == other.f && s <= other.s);
554 }
555
561 inline bool operator>(const uint256_t &other) {
562 return f > other.f || (f == other.f && s > other.s);
563 }
564
570 inline bool operator>=(const uint256_t &other) {
571 return (f > other.f) || (f == other.f && s >= other.s);
572 }
573
579 inline bool operator==(const uint256_t &other) {
580 return f == other.f && s == other.s;
581 }
582
588 inline bool operator!=(const uint256_t &other) {
589 return !((*this) == other);
590 }
591
596 inline bool operator!() { return !f && !s; }
597
603 inline bool operator&&(const uint256_t &b) {
604 return (s || f) && (b.s || b.f);
605 }
606
612 inline bool operator||(const uint256_t &b) {
613 return (s || f) || (b.s || b.f);
614 }
615
620 inline bool operator()() { return s || f; }
621
628 template <typename T, typename = typename std::enable_if<
629 std::is_integral<T>::value, T>::type>
630 bool operator<(const T &other) {
631 return *this < uint256_t(other);
632 }
633
640 template <typename T, typename = typename std::enable_if<
641 std::is_integral<T>::value, T>::type>
642 bool operator<=(const T &other) {
643 return *this <= uint256_t(other);
644 }
645
652 template <typename T, typename = typename std::enable_if<
653 std::is_integral<T>::value, T>::type>
654 bool operator>(const T &other) {
655 return *this > uint256_t(other);
656 }
657
664 template <typename T, typename = typename std::enable_if<
665 std::is_integral<T>::value, T>::type>
666 bool operator>=(const T &other) {
667 return *this >= uint256_t(other);
668 }
669
676 template <typename T, typename = typename std::enable_if<
677 std::is_integral<T>::value, T>::type>
678 bool operator==(const T &other) {
679 return *this == uint256_t(other);
680 }
681
688 template <typename T, typename = typename std::enable_if<
689 std::is_integral<T>::value, T>::type>
690 bool operator!=(const T &other) {
691 return *this != uint256_t(other);
692 }
693
700 template <typename T, typename = typename std::enable_if<
701 std::is_integral<T>::value, T>::type>
702 inline bool operator&&(const T &b) {
703 return (s || f) && (b);
704 }
705
713 template <typename T, typename = typename std::enable_if<
714 std::is_integral<T>::value, T>::type>
715 inline bool operator||(const T &b) {
716 return (s || f) || (b);
717 }
718
723 inline uint256_t operator~() { return {~f, ~s}; }
724
731 template <typename T, typename = typename std::enable_if<
732 std::is_integral<T>::value, T>::type>
733 uint256_t operator<<(const T &p) {
734 if (!p) {
735 return {this->f, this->s};
736 } else if (p >= 128) {
737 return uint256_t((this->s << (p - 128)), uint128_t(0));
738 }
739 return uint256_t((this->f << p) + (this->s >> (128 - p)),
740 (this->s << p));
741 }
742
749 template <typename T, typename = typename std::enable_if<
750 std::is_integral<T>::value, T>::type>
751 uint256_t &operator<<=(const T &p) {
752 if (p) {
753 if (p >= 128) {
754 this->f = (this->s << (p - 128));
755 this->s = uint128_t(0);
756 } else {
757 f = ((this->s >> (128 - p)) + (this->f << p));
758 s = (this->s << p);
759 }
760 }
761 return *this;
762 }
763
770 template <typename T, typename = typename std::enable_if<
771 std::is_integral<T>::value, T>::type>
772 uint256_t operator>>(const T &p) {
773 if (!p) {
774 return {this->f, this->s};
775 } else if (p >= 128) {
776 return uint256_t(uint128_t(0), (this->f >> (p - 128)));
777 }
778 return uint256_t((this->f >> p),
779 (this->s >> p) + (this->f << (128 - p)));
780 }
781
788 template <typename T, typename = typename std::enable_if<
789 std::is_integral<T>::value, T>::type>
790 uint256_t &operator>>=(const T &p) {
791 if (p) {
792 if (p >= 128) {
793 f = uint128_t(0);
794 s = (this->f >> (p - 128));
795 } else {
796 s = (this->s >> p) + (this->f << (128 - p));
797 f = (this->f >> p);
798 }
799 }
800 return *this;
801 }
802
809 template <typename T, typename = typename std::enable_if<
810 std::is_integral<T>::value, T>::type>
811 inline uint256_t operator&(const T &p) {
812 return *this & uint256_t(p);
813 }
814
820 inline uint256_t operator&(const uint256_t &p) {
821 return {f & p.f, s & p.s};
822 }
823
829 inline uint256_t &operator&=(const uint256_t &p) {
830 f &= p.f;
831 s &= p.s;
832 return *this;
833 }
834
841 template <typename T, typename = typename std::enable_if<
842 std::is_integral<T>::value, T>::type>
843 inline uint256_t &operator&=(const T p) {
844 s &= p.s;
845 return *this;
846 }
847
854 template <typename T, typename = typename std::enable_if<
855 std::is_integral<T>::value, T>::type>
856 inline uint256_t operator|(const T &p) {
857 return *this | uint256_t(p);
858 }
859
865 inline uint256_t operator|(const uint256_t &p) {
866 return {this->f | p.f, this->s | p.s};
867 }
868
875 template <typename T, typename = typename std::enable_if<
876 std::is_integral<T>::value, T>::type>
877 inline uint256_t &operator|=(const T &p) {
878 s |= p;
879 return *this;
880 }
881
887 inline uint256_t &operator|=(const uint256_t &p) {
888 f |= p.f;
889 s |= p.s;
890 return *this;
891 }
892
899 template <typename T, typename = typename std::enable_if<
900 std::is_integral<T>::value, T>::type>
901 inline uint256_t operator^(const T &p) {
902 return uint256_t(f, s ^ p);
903 }
904
910 inline uint256_t operator^(const uint256_t &p) {
911 return {this->f ^ p.f, this->s ^ p.s};
912 }
913
919 inline uint256_t &operator^=(const uint256_t &p) {
920 f ^= p.f;
921 s ^= p.s;
922 return *this;
923 }
924
931 template <typename T, typename = typename std::enable_if<
932 std::is_integral<T>::value, T>::type>
933 inline uint256_t &operator^=(const T &p) {
934 s ^= p;
935 return *this;
936 }
937
947 friend std::ostream &operator<<(std::ostream &op, uint256_t p) {
948 if (!p.f) {
949 op << p.s;
950 } else {
951 std::string out = "0", p_2 = "1";
952 uint128_t L(1);
953 for (uint64_t i = 0; i < 128; ++i) {
954 if ((p.s & L)) {
955 out = add(out, p_2);
956 }
957 p_2 = add(p_2, p_2);
958 L <<= 1;
959 }
960 L = uint128_t(1);
961 for (int i = 0; i < 128; ++i) {
962 if ((p.f & L)) {
963 out = add(out, p_2);
964 }
965 p_2 = add(p_2, p_2);
966 L <<= 1;
967 }
968 op << out;
969 }
970 return op;
971 }
972};
973
974// Artihmetic
975template <typename T, typename = typename std::enable_if<
976 std::is_integral<T>::value, T>::type>
977inline uint256_t operator+(const T p, const uint256_t &q) {
978 return uint256_t(p) + q;
979}
980
981template <typename T, typename = typename std::enable_if<
982 std::is_integral<T>::value, T>::type>
983inline uint256_t operator-(const T p, const uint256_t &q) {
984 return (uint256_t(p) - q);
985}
986
987template <typename T, typename = typename std::enable_if<
988 std::is_integral<T>::value, T>::type>
989inline uint256_t operator*(const T p, const uint256_t &q) {
990 return uint256_t(p) * q;
991}
992
993template <typename T, typename = typename std::enable_if<
994 std::is_integral<T>::value, T>::type>
995inline uint256_t operator/(const T p, const uint256_t &q) {
996 return uint256_t(p) / q;
997}
998
999template <typename T, typename = typename std::enable_if<
1000 std::is_integral<T>::value, T>::type>
1001inline uint256_t operator%(const T p, const uint256_t &q) {
1002 return uint256_t(p) % q;
1003}
1004
1005// Bitwise operators
1006template <typename T, typename = typename std::enable_if<
1007 std::is_integral<T>::value, T>::type>
1008inline uint256_t operator&(const T &p, const uint256_t &q) {
1009 return uint256_t(p) & q;
1010}
1011
1012template <typename T, typename = typename std::enable_if<
1013 std::is_integral<T>::value, T>::type>
1014inline uint256_t operator|(const T p, const uint256_t &q) {
1015 return uint256_t(p) | q;
1016}
1017
1018template <typename T, typename = typename std::enable_if<
1019 std::is_integral<T>::value, T>::type>
1020inline uint256_t operator^(const T p, const uint256_t &q) {
1021 return uint256_t(p) ^ q;
1022}
1023
1024// Boolean operators
1025template <typename T, typename = typename std::enable_if<
1026 std::is_integral<T>::value, T>::type>
1027inline bool operator&&(const T p, const uint256_t &q) {
1028 return uint256_t(p) && q;
1029}
1030
1031template <typename T, typename = typename std::enable_if<
1032 std::is_integral<T>::value, T>::type>
1033inline bool operator||(const T p, const uint256_t &q) {
1034 return uint256_t(p) || q;
1035}
1036
1037// Comparison operators
1038template <typename T, typename = typename std::enable_if<
1039 std::is_integral<T>::value, T>::type>
1040inline bool operator==(const T p, const uint256_t &q) {
1041 return uint256_t(p) == q;
1042}
1043
1044template <typename T, typename = typename std::enable_if<
1045 std::is_integral<T>::value, T>::type>
1046inline bool operator!=(const T p, const uint256_t &q) {
1047 return uint256_t(p) != q;
1048}
1049
1050template <typename T, typename = typename std::enable_if<
1051 std::is_integral<T>::value, T>::type>
1052inline bool operator<(const T p, const uint256_t &q) {
1053 return uint256_t(p) < q;
1054}
1055
1056template <typename T, typename = typename std::enable_if<
1057 std::is_integral<T>::value, T>::type>
1058inline bool operator<=(const T p, const uint256_t &q) {
1059 return uint256_t(p) <= q;
1060}
1061
1062template <typename T, typename = typename std::enable_if<
1063 std::is_integral<T>::value, T>::type>
1064inline bool operator>(const T p, const uint256_t &q) {
1065 return uint256_t(p) > q;
1066}
1067
1068template <typename T, typename = typename std::enable_if<
1069 std::is_integral<T>::value, T>::type>
1070inline bool operator>=(const T p, const uint256_t &q) {
1071 return uint256_t(p) >= q;
1072}
1073
1074#endif // CIPHERS_UINT256_T_HPP_
class for 128-bit unsigned integer
Definition uint128_t.hpp:60
uint64_t upper() const
returns upper 64-bit integer part
uint32_t _trz()
Trailing zeroes in binary.
uint64_t lower() const
returns lower 64-bit integer part
uint32_t _lez()
Leading zeroes in binary.
class for 256-bit unsigned integer
Definition uint256_t.hpp:33
uint256_t(uint128_t high, uint128_t low)
Parameterized constructor.
bool operator!()
operator ! for uint256_t
uint32_t _lez()
Leading zeroes in binary.
uint256_t(uint256_t &&num) noexcept
Move constructor.
Definition uint256_t.hpp:95
uint256_t & operator<<=(const T &p)
operator <<= for uint256_t
bool operator<=(const uint256_t &other)
operator <= for uint256_t
uint256_t(const std::string &str)
Parameterized constructor.
Definition uint256_t.hpp:81
bool operator<=(const T &other)
operator <= for other types
uint256_t operator+(const T &p)
operator + for uint256_t and other integer types.
uint256_t operator--(int p)
operator – (post-decrement)
uint256_t(const uint64_t high, const uint64_t low)
Parameterized constructor.
uint256_t & operator%=(const uint256_t &p)
operator %= for uint256_t
uint256_t operator|(const uint256_t &p)
operator | for uint256_t (bitwise operator)
bool operator&&(const T &b)
operator && for other types
uint256_t & operator&=(const uint256_t &p)
operator &= for uint256_t (bitwise operator)
uint256_t & operator^=(const T &p)
operator ^= for other types (bitwise operator)
~uint256_t()=default
Destructor for uint256_t.
uint256_t operator-()
operator - using twos complement
bool operator||(const uint256_t &b)
operator || for uint256_t
uint256_t(const uint256_t &num)=default
Copy constructor.
uint256_t & operator*=(const uint256_t &p)
operator *= for uint256_t and other integer types.
uint256_t operator>>(const T &p)
operator >> for uint256_t
uint256_t operator<<(const T &p)
operator << for uint256_t
bool operator||(const T &b)
operator || for other types
uint256_t & operator=(const uint256_t &p)=default
operator = for uint256_t
uint256_t operator/(const uint256_t &p)
operator / for uint256_t and other integer types.
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=(uint256_t &&p)=default
Move assignment operator.
uint256_t operator&(const T &p)
operator & for other types (bitwise operator)
uint256_t operator~()
operator ~ for uint256_t
uint256_t operator^(const uint256_t &p)
operator ^ for uint256_t (bitwise operator)
uint256_t & operator%=(const T &p)
operator %= for uint256_t
bool operator()()
operator () for uint256_t
uint256_t operator++(int)
post-increment operator
uint256_t operator%(const 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.
uint256_t & operator=(const std::string &p)
operator = for type string
uint256_t operator-(const T &p)
operator - for uint256_t and other integer types.
bool operator!=(const T &other)
operator != for other types
bool operator==(const uint256_t &other)
operator == for uint256_t
friend std::ostream & operator<<(std::ostream &op, uint256_t p)
operator << for printing uint256_t integer
bool operator==(const T &other)
operator == for other types
uint256_t operator&(const uint256_t &p)
operator & for uint256_t (bitwise operator)
uint32_t _trz()
Trailing zeroes in binary.
uint256_t & operator--()
operator – (pre-decrement)
bool operator&&(const uint256_t &b)
operator && for uint256_t
uint256_t & operator|=(const uint256_t &p)
operator |= for uint256_t (bitwise operator)
uint128_t lower() const
returns lower 128-bit integer part
uint256_t operator*(const uint256_t &p)
operator * for uint256_t and other integer types.
uint256_t operator*(const T &p)
operator * for uint256_t and other integer types.
bool operator!=(const uint256_t &other)
operator != for uint256_t
uint256_t operator-(const uint256_t &p)
operator - for uint256_t
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
bool operator<(const T &other)
operator < for other types
uint256_t & operator+=(const uint256_t &p)
operator += for uint256_t
uint256_t & operator^=(const uint256_t &p)
operator ^= for uint256_t (bitwise operator)
uint256_t operator/(const T &p)
operator / for uint256_t and other integer types.
bool operator>(const uint256_t &other)
operator > for uint256_t
uint256_t operator^(const T &p)
operator ^ for other types (bitwise operator)
uint256_t operator-=(const T p)
operator -= for uint256_t and other integer types.
uint256_t operator|(const T &p)
operator | for other types (bitwise operator)
uint256_t operator%(const uint256_t &p)
operator % for uint256_t
bool operator>(const T &other)
operator > for other types
uint256_t & operator>>=(const T &p)
operator >>= for uint256_t
uint256_t & operator=(const T &p)
operator = for other types
bool operator>=(const uint256_t &other)
operator >= for uint256_t
uint128_t upper() const
returns upper 128-bit integer part
uint256_t(T low)
Parameterized constructor.
Definition uint256_t.hpp:75
uint256_t & operator|=(const T &p)
operator |= for other types (bitwise operator)
uint256_t & operator++()
pre-increment operator
uint256_t operator+(const uint256_t &p)
operator + for uint256_t and other integer types.
uint256_t & operator*=(const T &p)
operator *= for uint256_t and other integer types.
uint256_t & operator&=(const T p)
operator &= for other types (bitwise operator)
bool operator<(const uint256_t &other)
operator < for uint256_t
void __get_integer_from_string(const std::string &str)
First and second half of 256 bit number.
Definition uint256_t.hpp:43
bool operator>=(const T &other)
operator >= for other types
std::string add(const std::string &first, const std::string &second)
Adding two string.
Definition uint128_t.hpp:38