reverse condition in uN::checked_sub
This commit is contained in:
parent
fe03fb9569
commit
7fde7308bf
@ -584,11 +584,11 @@ pub const fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
// 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