We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
uN::checked_sub
1 parent 367de08 commit b0c4baeCopy full SHA for b0c4bae
core/src/num/uint_macros.rs
@@ -584,11 +584,11 @@ macro_rules! uint_impl {
584
// Thus, rather than using `overflowing_sub` that produces a wrapping
585
// subtraction, check it ourself so we can use an unchecked one.
586
587
- if self >= rhs {
+ if self < rhs {
588
+ None
589
+ } else {
590
// SAFETY: just checked this can't overflow
591
Some(unsafe { intrinsics::unchecked_sub(self, rhs) })
- } else {
- None
592
}
593
594
0 commit comments