From fd8b8ced363a111b93c352cde5314a975beadc23 Mon Sep 17 00:00:00 2001 From: Ashish Bhanu Daulatabad Date: Sun, 11 Apr 2021 13:02:42 +0530 Subject: [PATCH] Error handling --- ciphers/uint256_t.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ciphers/uint256_t.hpp b/ciphers/uint256_t.hpp index 1245c5a01..b37194bd1 100644 --- a/ciphers/uint256_t.hpp +++ b/ciphers/uint256_t.hpp @@ -198,7 +198,7 @@ class uint256_t { */ inline uint256_t operator+(const uint256_t &p) { bool app = (s + p.s < s); - return {f + p.f + app, p.s + s}; + return {f + app + p.f, s + p.s}; } /** @@ -223,8 +223,8 @@ class uint256_t { */ inline uint256_t &operator+=(const uint256_t &p) { bool app = (p.s + s < s); - f += app + p.f; - s += p.s; + f = f + app + p.f; + s = s + p.s; return *this; } @@ -303,8 +303,8 @@ class uint256_t { std::is_integral::value, T>::type> inline uint256_t operator-=(const T p) { bool app = (p > s); - f -= app; - s -= p; + f = f - app; + s = s - p; return *this; } @@ -315,8 +315,8 @@ class uint256_t { */ inline uint256_t &operator-=(const uint256_t &p) { bool app = p.s > s; - f = f - p.f - app; - s -= p.s; + f = f - app - p.f; + s = s - p.s; return *this; }