Fix bug in wrapping_div
See discussion, albeit one-sided, in: https://github.com/rust-lang/rfcs/issues/964
This commit is contained in:
@@ -232,7 +232,7 @@ macro_rules! signed_overflowing_impl {
|
|||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn overflowing_div(self, rhs: $t) -> ($t, bool) {
|
fn overflowing_div(self, rhs: $t) -> ($t, bool) {
|
||||||
if self == $t::MIN && rhs == -1 {
|
if self == $t::MIN && rhs == -1 {
|
||||||
(1, true)
|
(self, true)
|
||||||
} else {
|
} else {
|
||||||
(self/rhs, false)
|
(self/rhs, false)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user