mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Error handling-2
This commit is contained in:
parent
fd8b8ced36
commit
7533ea152a
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user