replace |
with ||
in {unsigned_int}::borrowing_sub
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 sbb eax, esi setb dl ret ```
This commit is contained in:
parent
5913ef6660
commit
9fb66969e3
1 changed files with 1 additions and 1 deletions
|
@ -1606,7 +1606,7 @@ macro_rules! uint_impl {
|
||||||
// to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic
|
// to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic
|
||||||
let (a, b) = self.overflowing_sub(rhs);
|
let (a, b) = self.overflowing_sub(rhs);
|
||||||
let (c, d) = a.overflowing_sub(borrow as $SelfT);
|
let (c, d) = a.overflowing_sub(borrow as $SelfT);
|
||||||
(c, b | d)
|
(c, b || d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the absolute difference between `self` and `other`.
|
/// Computes the absolute difference between `self` and `other`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue