]> git.lizzy.rs Git - rust.git/commitdiff
Fix bug in `wrapping_div`
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Tue, 14 Apr 2015 16:44:14 +0000 (18:44 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Tue, 14 Apr 2015 16:44:14 +0000 (18:44 +0200)
See discussion, albeit one-sided, in:

  https://github.com/rust-lang/rfcs/issues/964

src/libcore/num/wrapping.rs

index 3ce2851f8e2f4d9878237a391b4a07b82a8d9650..aa84708816b8717b2eb8d035783eb01a37296721 100644 (file)
@@ -232,7 +232,7 @@ fn overflowing_mul(self, rhs: $t) -> ($t, bool) {
             #[inline(always)]
             fn overflowing_div(self, rhs: $t) -> ($t, bool) {
                 if self == $t::MIN && rhs == -1 {
-                    (1, true)
+                    (self, true)
                 } else {
                     (self/rhs, false)
                 }