Skip to content

Commit b032274

Browse files
committed
Type checks
1 parent a7ab392 commit b032274

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ciphers/uint256_t.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ 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-
bool app = s + p.s < s;
200+
uint32_t app = (s + p.s < s);
201201
return {f + app + p.f, p.s + s};
202202
}
203203

@@ -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-
bool app = p + s < s;
213+
uint32_t app = (p + s < s);
214214
this->f += app;
215215
this->s += p;
216216
return *this;
@@ -222,7 +222,7 @@ class uint256_t {
222222
* @returns addition of this and p, returning this
223223
*/
224224
inline uint256_t &operator+=(const uint256_t &p) {
225-
bool _app = (p.s + s < s);
225+
uint32_t _app = (p.s + s < s);
226226
f += _app + p.f;
227227
s += p.s;
228228
return *this;
@@ -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-
bool app = p > s;
258+
uint32_t app = (p > s);
259259
return uint256_t(f - app, s - p);
260260
}
261261

@@ -265,7 +265,7 @@ 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-
bool app = p.s > s;
268+
uint32_t app = p.s > s;
269269
return {f - p.f - app, s - p.s};
270270
}
271271

@@ -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-
bool app = p > s;
305+
uint32_t app = (p > s);
306306
f -= app;
307307
s -= p;
308308
return *this;
@@ -314,7 +314,7 @@ class uint256_t {
314314
* @returns subtraction of this and p, returning this
315315
*/
316316
inline uint256_t &operator-=(const uint256_t &p) {
317-
bool app = p.s > s;
317+
uint32_t app = p.s > s;
318318
f = f - app - p.f;
319319
s -= p.s;
320320
return *this;

0 commit comments

Comments
 (0)