mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
replace |
with ||
in {unsigned_int}::carrying_add
Using short-circuiting operators makes it easier to perform some kinds of source code analysis, like MC/DC code coverage (a requirement in safety-critical environments). The optimized x86_64 assembly is the same between the old and new versions: ``` mov eax, edi add dl, -1 adc eax, esi setb dl ret ```
This commit is contained in:
parent
47aeac648e
commit
5913ef6660
@ -1525,7 +1525,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`
|
||||
|
Loading…
Reference in New Issue
Block a user