about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-12-01 14:30:11 +0100
committerGitHub <noreply@github.com>2024-12-01 14:30:11 +0100
commit2f00feb6160927a84bd279d3f7de25b6d20de78a (patch)
tree94b5a8b2687b18e9dc6da2d4a7950dc27322277e /library
parent3d18c3c414f8fb5732ccb859a486f97173a38d83 (diff)
parent9836196e3cca6661e752c3acd8bc207f181736ed (diff)
downloadrust-2f00feb6160927a84bd279d3f7de25b6d20de78a.tar.gz
rust-2f00feb6160927a84bd279d3f7de25b6d20de78a.zip
Rollup merge of #133674 - scottmcm:chain-carrying-add, r=Amanieu
Fix chaining `carrying_add`s

Something about the MIR lowering for `||` ended up breaking this, but it's fixed by changing the code to use `|` instead.

I also added an assembly test to ensure it *keeps* being [`adc`](https://www.felixcloutier.com/x86/adc).

cc https://github.com/rust-lang/rust/issues/85532#issuecomment-2495119815, which noticed this.
Diffstat (limited to 'library')
-rw-r--r--library/core/src/num/uint_macros.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs
index 90b986f4998..0ebd765b549 100644
--- a/library/core/src/num/uint_macros.rs
+++ b/library/core/src/num/uint_macros.rs
@@ -2354,7 +2354,7 @@ macro_rules! uint_impl {
             //   to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic
             let (a, b) = self.overflowing_add(rhs);
             let (c, d) = a.overflowing_add(carry as $SelfT);
-            (c, b || d)
+            (c, b | d)
         }
 
         /// Calculates `self` + `rhs` with a signed `rhs`.