diff options
-rw-r--r-- | src/passwordmaker/base_conversion/remainders_impl.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/passwordmaker/base_conversion/remainders_impl.rs b/src/passwordmaker/base_conversion/remainders_impl.rs index 7bc6c0e..8f0a7f9 100644 --- a/src/passwordmaker/base_conversion/remainders_impl.rs +++ b/src/passwordmaker/base_conversion/remainders_impl.rs @@ -13,7 +13,7 @@ impl<const N : usize> Division<usize> for [u32;N] { //uses mutation, because why not? self is owned after all :D let divisor : UsizeAndFour = *divisor as UsizeAndFour; - let remainder = self.iter_mut().fold(0 as UsizeAndFour,|carry, current| { + let remainder = self.iter_mut().skip_while(|x| **x == 0).fold(0 as UsizeAndFour,|carry, current| { debug_assert_eq!(carry, carry & (usize::MAX as UsizeAndFour)); //carry has to be lower than divisor, and divisor is usize. let carry_shifted = carry << 32; let dividend = (carry_shifted) + (*current as UsizeAndFour); |