mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-07 04:23:30 +00:00
reverse condition in uN::checked_sub
This commit is contained in:
parent
fe03fb9569
commit
7fde7308bf
@ -584,11 +584,11 @@ macro_rules! uint_impl {
|
||||
// Thus, rather than using `overflowing_sub` that produces a wrapping
|
||||
// subtraction, check it ourself so we can use an unchecked one.
|
||||
|
||||
if self >= rhs {
|
||||
if self < rhs {
|
||||
None
|
||||
} else {
|
||||
// SAFETY: just checked this can't overflow
|
||||
Some(unsafe { intrinsics::unchecked_sub(self, rhs) })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user