From 1eaa169bbdf3fd2facb345abbb607332b5a71d3b Mon Sep 17 00:00:00 2001 From: Isaac Holt Date: Fri, 20 Sep 2024 14:47:36 +0100 Subject: [PATCH] fix carrying_add and borrwing_sub --- src/int/bigint_helpers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/int/bigint_helpers.rs b/src/int/bigint_helpers.rs index 6d76ca0..7e387da 100644 --- a/src/int/bigint_helpers.rs +++ b/src/int/bigint_helpers.rs @@ -7,7 +7,7 @@ macro_rules! impls { let (s1, o1) = self.overflowing_add(rhs); if carry { let (s2, o2) = s1.overflowing_add(Self::ONE); - (s2, o1 || o2) + (s2, o1 ^ o2) } else { (s1, o1) } @@ -20,7 +20,7 @@ macro_rules! impls { let (s1, o1) = self.overflowing_sub(rhs); if borrow { let (s2, o2) = s1.overflowing_sub(Self::ONE); - (s2, o1 || o2) + (s2, o1 ^ o2) } else { (s1, o1) }