mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-17 12:02:22 +08:00
Error handling-2
This commit is contained in:
@@ -222,7 +222,7 @@ class uint256_t {
|
|||||||
* @returns addition of this and p, returning this
|
* @returns addition of this and p, returning this
|
||||||
*/
|
*/
|
||||||
inline uint256_t &operator+=(const uint256_t &p) {
|
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;
|
f = f + app + p.f;
|
||||||
s = s + p.s;
|
s = s + p.s;
|
||||||
return *this;
|
return *this;
|
||||||
@@ -265,7 +265,7 @@ class uint256_t {
|
|||||||
* @returns subtraction of this and p, returning uint256_t integer
|
* @returns subtraction of this and p, returning uint256_t integer
|
||||||
*/
|
*/
|
||||||
inline uint256_t operator-(const uint256_t &p) {
|
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};
|
return {f - p.f - app, s - p.s};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ class uint256_t {
|
|||||||
* @returns subtraction of this and p, returning this
|
* @returns subtraction of this and p, returning this
|
||||||
*/
|
*/
|
||||||
inline uint256_t &operator-=(const uint256_t &p) {
|
inline uint256_t &operator-=(const uint256_t &p) {
|
||||||
bool app = p.s > s;
|
bool app = s < p.s;
|
||||||
f = f - app - p.f;
|
f = f - app - p.f;
|
||||||
s = s - p.s;
|
s = s - p.s;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
Reference in New Issue
Block a user