From 80f57b9f224c45663536732b9b174999ad643b83 Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Mon, 2 Apr 2018 15:24:48 -0400 Subject: [PATCH] Fix division by not returning a weirdly-shifted remainder when the quotient is zero. --- src/cryptonum/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonum/mod.rs b/src/cryptonum/mod.rs index fc2521d..2034e9b 100644 --- a/src/cryptonum/mod.rs +++ b/src/cryptonum/mod.rs @@ -573,7 +573,7 @@ fn divmod(quotient: &mut Vec, remainder: &mut Vec, let n = x.contents.len(); let t = y.contents.len(); if n < t { - remainder.append(&mut x.contents); + remainder.extend_from_slice(&inx); return; } // Also, it's real convient for n and t to be greater than one, which we