Skip to content

Commit

Permalink
Fix chaining carrying_adds
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
scottmcm authored and gitbot committed Feb 20, 2025
1 parent c99f71d commit 47f5497
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 47f5497

Please sign in to comment.