From 7533ea152adfa74a7846911f1699e56dcdb831bc Mon Sep 17 00:00:00 2001 From: Ashish Bhanu Daulatabad Date: Sun, 11 Apr 2021 13:08:35 +0530 Subject: [PATCH] Error handling-2 --- ciphers/uint256_t.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ciphers/uint256_t.hpp b/ciphers/uint256_t.hpp index b37194bd1..300ccd89e 100644 --- a/ciphers/uint256_t.hpp +++ b/ciphers/uint256_t.hpp @@ -222,7 +222,7 @@ class uint256_t { * @returns addition of this and p, returning this */ inline uint256_t &operator+=(const uint256_t &p) { - bool app = (p.s + s < s); + bool app = (s + p.s < s); f = f + app + p.f; s = s + p.s; return *this; @@ -265,7 +265,7 @@ class uint256_t { * @returns subtraction of this and p, returning uint256_t integer */ inline uint256_t operator-(const uint256_t &p) { - bool app = p.s > s; + bool app = s < p.s; return {f - p.f - app, s - p.s}; } @@ -314,7 +314,7 @@ class uint256_t { * @returns subtraction of this and p, returning this */ inline uint256_t &operator-=(const uint256_t &p) { - bool app = p.s > s; + bool app = s < p.s; f = f - app - p.f; s = s - p.s; return *this;