From 45eab6b8a16c76d38649c2d69bdc887f386eb613 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sat, 30 Nov 2024 15:50:07 +0100 Subject: [PATCH] perf: use bitwise operations in add/sub impls --- src/add.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add.rs b/src/add.rs index c1fa5f3..77269b5 100644 --- a/src/add.rs +++ b/src/add.rs @@ -61,7 +61,7 @@ impl Uint { const fn u64_carrying_add(lhs: u64, rhs: u64, carry: bool) -> (u64, bool) { let (a, b) = lhs.overflowing_add(rhs); let (c, d) = a.overflowing_add(carry as u64); - (c, b || d) + (c, b | d) } if BITS == 0 { @@ -103,7 +103,7 @@ impl Uint { const fn u64_borrowing_sub(lhs: u64, rhs: u64, borrow: bool) -> (u64, bool) { let (a, b) = lhs.overflowing_sub(rhs); let (c, d) = a.overflowing_sub(borrow as u64); - (c, b || d) + (c, b | d) } if BITS == 0 {