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
24class uint256_t {
25 uint128_t f{}, s{};
26
34 void __get_integer_from_string(const std::string &str) {
35 this->f = this->s = uint128_t(0);
36 if (str.size() > 1 && str[1] == 'x') {
37 for (auto i = 2; i < str.size(); ++i) {
38 *this *= 16LL;
39 if (str[i] >= '0' && str[i] <= '9') {
40 *this += (str[i] - '0');
41 } else if (str[i] >= 'A' && str[i] <= 'F') {
42 *this += (str[i] - 'A' + 10);
43 } else if (str[i] >= 'a' && str[i] <= 'f') {
44 *this += (str[i] - 'a' + 10);
45 }
46 }
47 } else {
48 for (auto &x : str) {
49 *this *= 10LL;
50 *this += (x - '0');
51 }
52 }
53 }
54
55 public:
56 // Constructors
57 uint256_t() = default;
58
64 template <typename T, typename = typename std::enable_if<
65 std::is_integral<T>::value, T>::type>
66 explicit uint256_t(T low) : f(0), s(low) {}
67
72 explicit uint256_t(const std::string &str) {
74 }
75
80 uint256_t(const uint256_t &num) = default;
81
86 uint256_t(uint256_t &&num) noexcept
87 : f(std::move(num.f)), s(std::move(num.s)) {}
88
95 : f(std::move(high)), s(std::move(low)) {}
96
102 uint256_t(const uint64_t high, const uint64_t low) : f(high), s(low) {}
103
107 ~uint256_t() = default;
108
114 inline uint32_t _lez() {
115 if (f) {
116 return f._lez();
117 }
118 return 128 + s._lez();
119 }
120
126 inline uint32_t _trz() {
127 if (s) {
128 return s._trz();
129 }
130 return 128 + f._trz();
131 }
132
137 inline explicit operator bool() const { return f || s; }
138
144 template <typename T, typename = typename std::enable_if<
145 std::is_integral<T>::value, T>::type>
146 inline explicit operator T() const {
147 return static_cast<T>(s);
148 }
149
154 inline explicit operator uint128_t() const { return s; }
155
160 inline uint128_t lower() const { return s; }
161
166 inline uint128_t upper() const { return f; }
167
173 inline uint256_t &operator=(const uint256_t &p) = default;
174
181 template <typename T, typename = typename std::enable_if<
182 std::is_integral<T>::value, T>::type>
183 inline uint256_t &operator=(const T &p) {
184 this->s = p;
185 return *this;
186 }
187
193 inline uint256_t &operator=(const std::string &p) {
195 return *this;
196 }
197
201 inline uint256_t &operator=(uint256_t &&p) = default;
202
209 template <typename T, typename = typename std::enable_if<
210 std::is_integral<T>::value, T>::type>
211 inline uint256_t operator+(const T &p) {
212 bool app = s + p < s;
213 return uint256_t(f + app, s + p);
214 }
215
221 inline uint256_t operator+(const uint256_t &p) {
222 bool app = (s + p.s < s);
223 return {f + app + p.f, s + p.s};
224 }
225
232 template <typename T, typename = typename std::enable_if<
233 std::is_integral<T>::value, T>::type>
234 inline uint256_t &operator+=(const T &p) {
235 bool app = (p + s < s);
236 this->f += app;
237 this->s += p;
238 return *this;
239 }
240
246 inline uint256_t &operator+=(const uint256_t &p) {
247 bool app = (s + p.s < s);
248 f = f + app + p.f;
249 s = s + p.s;
250 return *this;
251 }
252
257 inline uint256_t &operator++() {
258 *this += 1;
259 return *this;
260 }
261
266 inline uint256_t operator++(int) {
267 ++*this;
268 return *this;
269 }
270
277 template <typename T, typename = typename std::enable_if<
278 std::is_integral<T>::value, T>::type>
279 inline uint256_t operator-(const T &p) {
280 bool app = (p > s);
281 return uint256_t(f - app, s - p);
282 }
283
289 inline uint256_t operator-(const uint256_t &p) {
290 bool app = s < p.s;
291 return {f - p.f - app, s - p.s};
292 }
293
298 inline uint256_t operator-() { return ~*this + uint256_t(1); }
299
304 inline uint256_t &operator--() {
305 *this -= 1;
306 return *this;
307 }
308
313 inline uint256_t operator--(int) {
314 --*this;
315 return *this;
316 }
317
324 template <typename T, typename = typename std::enable_if<
325 std::is_integral<T>::value, T>::type>
326 inline uint256_t operator-=(const T p) {
327 bool app = (p > s);
328 f = f - app;
329 s = s - p;
330 return *this;
331 }
332
338 inline uint256_t &operator-=(const uint256_t &p) {
339 bool app = s < p.s;
340 f = f - app - p.f;
341 s = s - p.s;
342 return *this;
343 }
344
351 template <typename T, typename = typename std::enable_if<
352 std::is_integral<T>::value, T>::type>
353 inline uint256_t operator*(const T &p) {
354 return *this * uint256_t(p);
355 }
356
362 uint256_t operator*(const uint256_t &p) {
363 uint128_t f_first(s.upper()), f_second(s.lower()), s_first(p.s.upper()),
364 s_second(p.s.lower());
365 uint128_t fi = f_first * s_first, se = f_first * s_second,
366 th = s_first * f_second, fo = s_second * f_second;
367 uint128_t tmp = se << 64, tmp2 = th << 64;
368 int cc = (tmp + tmp2 < tmp);
369 tmp += tmp2;
370 cc += (tmp + fo < tmp);
371 return {f * p.s + s * p.f + fi + se.upper() + th.upper() + cc,
372 tmp + fo};
373 }
374
381 template <typename T, typename = typename std::enable_if<
382 std::is_integral<T>::value, T>::type>
383 inline uint256_t &operator*=(const T &p) {
384 return (*this *= uint256_t(p));
385 }
386
392 uint256_t &operator*=(const uint256_t &p) {
393 uint128_t f_first(s.upper()), f_second(s.lower()), s_first(p.s.upper()),
394 s_second(p.s.lower());
395 uint128_t fi = f_first * s_first, se = f_first * s_second,
396 th = s_first * f_second, fo = s_second * f_second;
397 uint128_t tmp = se << 64, tmp2 = th << 64;
398 int cc = (tmp + tmp2 < tmp);
399 tmp += tmp2;
400 cc += (tmp + fo < tmp);
401 f = f * p.s + s * p.f + fi + se.upper() + th.upper() + cc;
402 s = tmp + fo;
403 return *this;
404 }
405
412 std::pair<uint256_t, uint256_t> divide(const uint256_t &p) {
413 if (*this < p) { // if this is less than divisor
414 return {uint256_t(0), *this};
415 } else if (*this == p) { // if this is equal to divisor
416 return {uint256_t(1), uint256_t(0)};
417 }
418 uint256_t tmp = p, tmp2 = *this;
419 uint16_t left = tmp._lez() - _lez();
420 tmp <<= left;
421 uint256_t quotient(0);
422 uint256_t zero(0);
423 while (tmp2 >= p) {
424 uint16_t shf = tmp2._lez() - tmp._lez();
425 if (shf) {
426 tmp >>= shf;
427 quotient <<= shf;
428 left -= shf;
429 }
430 if (tmp2 < tmp) {
431 tmp >>= 1;
432 quotient <<= 1;
433 --left;
434 }
435 tmp2 -= tmp;
436 ++quotient;
437 }
438 return {quotient << left, tmp2};
439 }
440
447 template <typename T, typename = typename std::enable_if<
448 std::is_integral<T>::value, T>::type>
449 inline uint256_t operator/(const T &p) {
450 uint256_t tmp = *this;
451 tmp /= uint256_t(p);
452 return tmp;
453 }
454
460 inline uint256_t operator/(const uint256_t &p) { return divide(p).first; }
461
467 inline uint256_t &operator/=(const uint256_t &p) {
468 *this = divide(p).first;
469 return *this;
470 }
471
478 template <typename T, typename = typename std::enable_if<
479 std::is_integral<T>::value, T>::type>
480 inline uint256_t &operator/=(const T &p) {
481 *this /= uint256_t(p);
482 return *this;
483 }
484
490 inline uint256_t operator%(const uint256_t &p) { return divide(p).second; }
491
498 template <typename T, typename = typename std::enable_if<
499 std::is_integral<T>::value, T>::type>
500 inline uint256_t operator%(const T &p) {
501 uint256_t tmp = *this;
502 tmp %= uint256_t(p);
503 return tmp;
504 }
505
511 inline uint256_t &operator%=(const uint256_t &p) {
512 *this = divide(p).second;
513 return *this;
514 }
515
522 template <typename T, typename = typename std::enable_if<
523 std::is_integral<T>::value, T>::type>
524 inline uint256_t &operator%=(const T &p) {
525 *this %= uint256_t(p);
526 return *this;
527 }
528
534 inline bool operator<(const uint256_t &other) {
535 return f < other.f || (f == other.f && s < other.s);
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 && s == other.s;
572 }
573
579 inline bool operator!=(const uint256_t &other) {
580 return !((*this) == other);
581 }
582
587 inline bool operator!() { return !f && !s; }
588
594 inline bool operator&&(const uint256_t &b) {
595 return (s || f) && (b.s || b.f);
596 }
597
603 inline bool operator||(const uint256_t &b) {
604 return (s || f) || (b.s || b.f);
605 }
606
611 inline bool operator()() { return s || f; }
612
619 template <typename T, typename = typename std::enable_if<
620 std::is_integral<T>::value, T>::type>
621 bool operator<(const T &other) {
622 return *this < uint256_t(other);
623 }
624
631 template <typename T, typename = typename std::enable_if<
632 std::is_integral<T>::value, T>::type>
633 bool operator<=(const T &other) {
634 return *this <= uint256_t(other);
635 }
636
643 template <typename T, typename = typename std::enable_if<
644 std::is_integral<T>::value, T>::type>
645 bool operator>(const T &other) {
646 return *this > uint256_t(other);
647 }
648
655 template <typename T, typename = typename std::enable_if<
656 std::is_integral<T>::value, T>::type>
657 bool operator>=(const T &other) {
658 return *this >= uint256_t(other);
659 }
660
667 template <typename T, typename = typename std::enable_if<
668 std::is_integral<T>::value, T>::type>
669 bool operator==(const T &other) {
670 return *this == uint256_t(other);
671 }
672
679 template <typename T, typename = typename std::enable_if<
680 std::is_integral<T>::value, T>::type>
681 bool operator!=(const T &other) {
682 return *this != uint256_t(other);
683 }
684
691 template <typename T, typename = typename std::enable_if<
692 std::is_integral<T>::value, T>::type>
693 inline bool operator&&(const T &b) {
694 return (s || f) && (b);
695 }
696
704 template <typename T, typename = typename std::enable_if<
705 std::is_integral<T>::value, T>::type>
706 inline bool operator||(const T &b) {
707 return (s || f) || (b);
708 }
709
714 inline uint256_t operator~() { return {~f, ~s}; }
715
722 template <typename T, typename = typename std::enable_if<
723 std::is_integral<T>::value, T>::type>
724 uint256_t operator<<(const T &p) {
725 if (!p) {
726 return {this->f, this->s};
727 } else if (p >= 128) {
728 return uint256_t((this->s << (p - 128)), uint128_t(0));
729 }
730 return uint256_t((this->f << p) + (this->s >> (128 - p)),
731 (this->s << p));
732 }
733
740 template <typename T, typename = typename std::enable_if<
741 std::is_integral<T>::value, T>::type>
742 uint256_t &operator<<=(const T &p) {
743 if (p) {
744 if (p >= 128) {
745 this->f = (this->s << (p - 128));
746 this->s = uint128_t(0);
747 } else {
748 f = ((this->s >> (128 - p)) + (this->f << p));
749 s = (this->s << p);
750 }
751 }
752 return *this;
753 }
754
761 template <typename T, typename = typename std::enable_if<
762 std::is_integral<T>::value, T>::type>
763 uint256_t operator>>(const T &p) {
764 if (!p) {
765 return {this->f, this->s};
766 } else if (p >= 128) {
767 return uint256_t(uint128_t(0), (this->f >> (p - 128)));
768 }
769 return uint256_t((this->f >> p),
770 (this->s >> p) + (this->f << (128 - p)));
771 }
772
779 template <typename T, typename = typename std::enable_if<
780 std::is_integral<T>::value, T>::type>
781 uint256_t &operator>>=(const T &p) {
782 if (p) {
783 if (p >= 128) {
784 f = uint128_t(0);
785 s = (this->f >> (p - 128));
786 } else {
787 s = (this->s >> p) + (this->f << (128 - p));
788 f = (this->f >> p);
789 }
790 }
791 return *this;
792 }
793
800 template <typename T, typename = typename std::enable_if<
801 std::is_integral<T>::value, T>::type>
802 inline uint256_t operator&(const T &p) {
803 return *this & uint256_t(p);
804 }
805
811 inline uint256_t operator&(const uint256_t &p) {
812 return {f & p.f, s & p.s};
813 }
814
820 inline uint256_t &operator&=(const uint256_t &p) {
821 f &= p.f;
822 s &= p.s;
823 return *this;
824 }
825
832 template <typename T, typename = typename std::enable_if<
833 std::is_integral<T>::value, T>::type>
834 inline uint256_t &operator&=(const T p) {
835 s &= p.s;
836 return *this;
837 }
838
845 template <typename T, typename = typename std::enable_if<
846 std::is_integral<T>::value, T>::type>
847 inline uint256_t operator|(const T &p) {
848 return *this | uint256_t(p);
849 }
850
856 inline uint256_t operator|(const uint256_t &p) {
857 return {this->f | p.f, this->s | p.s};
858 }
859
866 template <typename T, typename = typename std::enable_if<
867 std::is_integral<T>::value, T>::type>
868 inline uint256_t &operator|=(const T &p) {
869 s |= p;
870 return *this;
871 }
872
878 inline uint256_t &operator|=(const uint256_t &p) {
879 f |= p.f;
880 s |= p.s;
881 return *this;
882 }
883
890 template <typename T, typename = typename std::enable_if<
891 std::is_integral<T>::value, T>::type>
892 inline uint256_t operator^(const T &p) {
893 return uint256_t(f, s ^ p);
894 }
895
901 inline uint256_t operator^(const uint256_t &p) {
902 return {this->f ^ p.f, this->s ^ p.s};
903 }
904
910 inline uint256_t &operator^=(const uint256_t &p) {
911 f ^= p.f;
912 s ^= p.s;
913 return *this;
914 }
915
922 template <typename T, typename = typename std::enable_if<
923 std::is_integral<T>::value, T>::type>
924 inline uint256_t &operator^=(const T &p) {
925 s ^= p;
926 return *this;
927 }
928
938 friend std::ostream &operator<<(std::ostream &op, uint256_t p) {
939 if (!p.f) {
940 op << p.s;
941 } else {
942 std::string out = "0", p_2 = "1";
943 uint128_t L(1);
944 for (uint64_t i = 0; i < 128; ++i) {
945 if ((p.s & L)) {
946 out = add(out, p_2);
947 }
948 p_2 = add(p_2, p_2);
949 L <<= 1;
950 }
951 L = uint128_t(1);
952 for (int i = 0; i < 128; ++i) {
953 if ((p.f & L)) {
954 out = add(out, p_2);
955 }
956 p_2 = add(p_2, p_2);
957 L <<= 1;
958 }
959 op << out;
960 }
961 return op;
962 }
963};
964
965// Artihmetic
966template <typename T, typename = typename std::enable_if<
967 std::is_integral<T>::value, T>::type>
968inline uint256_t operator+(const T p, const uint256_t &q) {
969 return uint256_t(p) + q;
970}
971
972template <typename T, typename = typename std::enable_if<
973 std::is_integral<T>::value, T>::type>
974inline uint256_t operator-(const T p, const uint256_t &q) {
975 return (uint256_t(p) - q);
976}
977
978template <typename T, typename = typename std::enable_if<
979 std::is_integral<T>::value, T>::type>
980inline uint256_t operator*(const T p, const uint256_t &q) {
981 return uint256_t(p) * q;
982}
983
984template <typename T, typename = typename std::enable_if<
985 std::is_integral<T>::value, T>::type>
986inline uint256_t operator/(const T p, const uint256_t &q) {
987 return uint256_t(p) / q;
988}
989
990template <typename T, typename = typename std::enable_if<
991 std::is_integral<T>::value, T>::type>
992inline uint256_t operator%(const T p, const uint256_t &q) {
993 return uint256_t(p) % q;
994}
995
996// Bitwise operators
997template <typename T, typename = typename std::enable_if<
998 std::is_integral<T>::value, T>::type>
999inline uint256_t operator&(const T &p, const uint256_t &q) {
1000 return uint256_t(p) & q;
1001}
1002
1003template <typename T, typename = typename std::enable_if<
1004 std::is_integral<T>::value, T>::type>
1005inline uint256_t operator|(const T p, const uint256_t &q) {
1006 return uint256_t(p) | q;
1007}
1008
1009template <typename T, typename = typename std::enable_if<
1010 std::is_integral<T>::value, T>::type>
1011inline uint256_t operator^(const T p, const uint256_t &q) {
1012 return uint256_t(p) ^ q;
1013}
1014
1015// Boolean operators
1016template <typename T, typename = typename std::enable_if<
1017 std::is_integral<T>::value, T>::type>
1018inline bool operator&&(const T p, const uint256_t &q) {
1019 return uint256_t(p) && q;
1020}
1021
1022template <typename T, typename = typename std::enable_if<
1023 std::is_integral<T>::value, T>::type>
1024inline bool operator||(const T p, const uint256_t &q) {
1025 return uint256_t(p) || q;
1026}
1027
1028// Comparison operators
1029template <typename T, typename = typename std::enable_if<
1030 std::is_integral<T>::value, T>::type>
1031inline bool operator==(const T p, const uint256_t &q) {
1032 return uint256_t(p) == q;
1033}
1034
1035template <typename T, typename = typename std::enable_if<
1036 std::is_integral<T>::value, T>::type>
1037inline bool operator!=(const T p, const uint256_t &q) {
1038 return uint256_t(p) != q;
1039}
1040
1041template <typename T, typename = typename std::enable_if<
1042 std::is_integral<T>::value, T>::type>
1043inline bool operator<(const T p, const uint256_t &q) {
1044 return uint256_t(p) < q;
1045}
1046
1047template <typename T, typename = typename std::enable_if<
1048 std::is_integral<T>::value, T>::type>
1049inline bool operator<=(const T p, const uint256_t &q) {
1050 return uint256_t(p) <= q;
1051}
1052
1053template <typename T, typename = typename std::enable_if<
1054 std::is_integral<T>::value, T>::type>
1055inline bool operator>(const T p, const uint256_t &q) {
1056 return uint256_t(p) > q;
1057}
1058
1059template <typename T, typename = typename std::enable_if<
1060 std::is_integral<T>::value, T>::type>
1061inline bool operator>=(const T p, const uint256_t &q) {
1062 return uint256_t(p) >= q;
1063}
1064
1065#endif // CIPHERS_UINT256_T_HPP_
class for 128-bit unsigned integer
Definition uint128_t.hpp:53
uint64_t upper() const
returns upper 64-bit integer part
uint64_t lower() const
returns lower 64-bit integer part
class for 256-bit unsigned integer
Definition uint256_t.hpp:24
uint256_t(uint128_t high, uint128_t low)
Parameterized constructor.
Definition uint256_t.hpp:94
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:86
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:72
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(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--(int)
operator – (post-decrement)
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:66
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:34
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:31