Skip to content

Commit 2c41f11

Browse files
committed
windows error
1 parent b032274 commit 2c41f11

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

ciphers/uint128_t.hpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ class uint128_t {
688688
return *this;
689689
}
690690

691-
uint128_t operator&(const uint128_t &p) {
691+
inline uint128_t operator&(const uint128_t &p) {
692692
return uint128_t(this->f & p.f, this->s & p.s);
693693
}
694694

@@ -714,11 +714,11 @@ class uint128_t {
714714

715715
template <typename T, typename = typename std::enable_if<
716716
std::is_integral<T>::value, T>::type>
717-
uint128_t operator|(const T p) {
717+
inline uint128_t operator|(const T p) {
718718
return uint128_t(p | s);
719719
}
720720

721-
uint128_t operator|(const uint128_t &p) {
721+
inline uint128_t operator|(const uint128_t &p) {
722722
return uint128_t(this->f | p.f, this->s | p.s);
723723
}
724724

@@ -730,18 +730,18 @@ class uint128_t {
730730

731731
template <typename T, typename = typename std::enable_if<
732732
std::is_integral<T>::value, T>::type>
733-
uint128_t &operator|=(const T p) {
733+
inline uint128_t &operator|=(const T p) {
734734
s |= p.s;
735735
return *this;
736736
}
737737

738738
template <typename T, typename = typename std::enable_if<
739739
std::is_integral<T>::value, T>::type>
740-
uint128_t operator^(const T p) {
740+
inline uint128_t operator^(const T p) {
741741
return uint128_t(this->f, this->s ^ p);
742742
}
743743

744-
uint128_t operator^(const uint128_t &p) {
744+
inline uint128_t operator^(const uint128_t &p) {
745745
return uint128_t(this->f ^ p.f, this->s ^ p.s);
746746
}
747747

@@ -753,7 +753,7 @@ class uint128_t {
753753

754754
template <typename T, typename = typename std::enable_if<
755755
std::is_integral<T>::value, T>::type>
756-
uint128_t &operator^=(const T &p) {
756+
inline uint128_t &operator^=(const T &p) {
757757
s ^= p;
758758
return *this;
759759
}
@@ -787,100 +787,100 @@ class uint128_t {
787787
// Arithmetic operators
788788
template <typename T, typename = typename std::enable_if<
789789
std::is_integral<T>::value, T>::type>
790-
uint128_t operator+(const T &p, const uint128_t &q) {
790+
inline uint128_t operator+(const T &p, const uint128_t &q) {
791791
return uint128_t(p) + q;
792792
}
793793

794794
template <typename T, typename = typename std::enable_if<
795795
std::is_integral<T>::value, T>::type>
796-
uint128_t operator-(const T p, const uint128_t &q) {
796+
inline uint128_t operator-(const T p, const uint128_t &q) {
797797
return uint128_t(p) - q;
798798
}
799799

800800
template <typename T, typename = typename std::enable_if<
801801
std::is_integral<T>::value, T>::type>
802-
uint128_t operator*(const T p, const uint128_t &q) {
803-
return q * p;
802+
inline uint128_t operator*(const T p, const uint128_t &q) {
803+
return uint128_t(p) * q;
804804
}
805805

806806
template <typename T, typename = typename std::enable_if<
807807
std::is_integral<T>::value, T>::type>
808-
uint128_t operator/(const T p, const uint128_t &q) {
808+
inline uint128_t operator/(const T p, const uint128_t &q) {
809809
return uint128_t(p) / q;
810810
}
811811

812812
template <typename T, typename = typename std::enable_if<
813813
std::is_integral<T>::value, T>::type>
814-
uint128_t operator%(const T p, const uint128_t &q) {
814+
inline uint128_t operator%(const T p, const uint128_t &q) {
815815
return uint128_t(p) % q;
816816
}
817817

818818
// Bitwise operators
819819
template <typename T, typename = typename std::enable_if<
820820
std::is_integral<T>::value, T>::type>
821-
uint128_t operator&(const T &p, const uint128_t &q) {
821+
inline uint128_t operator&(const T &p, const uint128_t &q) {
822822
return uint128_t(p) & q;
823823
}
824824

825825
template <typename T, typename = typename std::enable_if<
826826
std::is_integral<T>::value, T>::type>
827-
uint128_t operator|(const T p, const uint128_t &q) {
827+
inline uint128_t operator|(const T p, const uint128_t &q) {
828828
return uint128_t(p) | q;
829829
}
830830

831831
template <typename T, typename = typename std::enable_if<
832832
std::is_integral<T>::value, T>::type>
833-
uint128_t operator^(const T p, const uint128_t &q) {
833+
inline uint128_t operator^(const T p, const uint128_t &q) {
834834
return uint128_t(p) ^ q;
835835
}
836836

837837
// Boolean operators
838838
template <typename T, typename = typename std::enable_if<
839839
std::is_integral<T>::value, T>::type>
840-
bool operator&&(const T p, const uint128_t &q) {
840+
inline bool operator&&(const T p, const uint128_t &q) {
841841
return uint128_t(p) && q;
842842
}
843843

844844
template <typename T, typename = typename std::enable_if<
845845
std::is_integral<T>::value, T>::type>
846-
bool operator||(const T p, const uint128_t &q) {
846+
inline bool operator||(const T p, const uint128_t &q) {
847847
return uint128_t(p) || q;
848848
}
849849

850850
// Comparison operators
851851
template <typename T, typename = typename std::enable_if<
852852
std::is_integral<T>::value, T>::type>
853-
bool operator==(const T p, const uint128_t &q) {
853+
inline bool operator==(const T p, const uint128_t &q) {
854854
return uint128_t(p) == q;
855855
}
856856

857857
template <typename T, typename = typename std::enable_if<
858858
std::is_integral<T>::value, T>::type>
859-
bool operator!=(const T p, const uint128_t &q) {
859+
inline bool operator!=(const T p, const uint128_t &q) {
860860
return uint128_t(p) != q;
861861
}
862862

863863
template <typename T, typename = typename std::enable_if<
864864
std::is_integral<T>::value, T>::type>
865-
bool operator<(const T p, const uint128_t &q) {
865+
inline bool operator<(const T p, const uint128_t &q) {
866866
return uint128_t(p) < q;
867867
}
868868

869869
template <typename T, typename = typename std::enable_if<
870870
std::is_integral<T>::value, T>::type>
871-
bool operator<=(const T p, const uint128_t &q) {
871+
inline bool operator<=(const T p, const uint128_t &q) {
872872
return uint128_t(p) <= q;
873873
}
874874

875875
template <typename T, typename = typename std::enable_if<
876876
std::is_integral<T>::value, T>::type>
877-
bool operator>(const T p, const uint128_t &q) {
877+
inline bool operator>(const T p, const uint128_t &q) {
878878
return uint128_t(p) > q;
879879
}
880880

881881
template <typename T, typename = typename std::enable_if<
882882
std::is_integral<T>::value, T>::type>
883-
bool operator>=(const T p, const uint128_t &q) {
883+
inline bool operator>=(const T p, const uint128_t &q) {
884884
return uint128_t(p) >= q;
885885
}
886886

ciphers/uint256_t.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ class uint256_t {
197197
* @returns addition of this and p, returning uint256_t integer
198198
*/
199199
inline uint256_t operator+(const uint256_t &p) {
200-
uint32_t app = (s + p.s < s);
201-
return {f + app + p.f, p.s + s};
200+
bool app = (s + p.s < s);
201+
return uint256_t(f + p.f + app, p.s + s);
202202
}
203203

204204
/**
@@ -210,7 +210,7 @@ class uint256_t {
210210
template <typename T, typename = typename std::enable_if<
211211
std::is_integral<T>::value, T>::type>
212212
inline uint256_t &operator+=(const T &p) {
213-
uint32_t app = (p + s < s);
213+
bool app = (p + s < s);
214214
this->f += app;
215215
this->s += p;
216216
return *this;
@@ -222,8 +222,8 @@ class uint256_t {
222222
* @returns addition of this and p, returning this
223223
*/
224224
inline uint256_t &operator+=(const uint256_t &p) {
225-
uint32_t _app = (p.s + s < s);
226-
f += _app + p.f;
225+
bool app = (p.s + s < s);
226+
f += app + p.f;
227227
s += p.s;
228228
return *this;
229229
}
@@ -255,7 +255,7 @@ class uint256_t {
255255
template <typename T, typename = typename std::enable_if<
256256
std::is_integral<T>::value, T>::type>
257257
inline uint256_t operator-(const T &p) {
258-
uint32_t app = (p > s);
258+
bool app = (p > s);
259259
return uint256_t(f - app, s - p);
260260
}
261261

@@ -265,8 +265,8 @@ class uint256_t {
265265
* @returns subtraction of this and p, returning uint256_t integer
266266
*/
267267
inline uint256_t operator-(const uint256_t &p) {
268-
uint32_t app = p.s > s;
269-
return {f - p.f - app, s - p.s};
268+
bool app = p.s > s;
269+
return uint256_t(f - p.f - app, s - p.s);
270270
}
271271

272272
/**
@@ -302,7 +302,7 @@ class uint256_t {
302302
template <typename T, typename = typename std::enable_if<
303303
std::is_integral<T>::value, T>::type>
304304
inline uint256_t operator-=(const T p) {
305-
uint32_t app = (p > s);
305+
bool app = (p > s);
306306
f -= app;
307307
s -= p;
308308
return *this;
@@ -314,8 +314,8 @@ class uint256_t {
314314
* @returns subtraction of this and p, returning this
315315
*/
316316
inline uint256_t &operator-=(const uint256_t &p) {
317-
uint32_t app = p.s > s;
318-
f = f - app - p.f;
317+
bool app = p.s > s;
318+
f = f - p.f - app;
319319
s -= p.s;
320320
return *this;
321321
}

0 commit comments

Comments
 (0)