瀏覽代碼

Fix normalization in scalar addition

Sam Cappleman-Lynes 7 年之前
父節點
當前提交
fd87d87db3
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      bigint/src/biguint.rs

+ 1 - 1
bigint/src/biguint.rs

@@ -402,7 +402,7 @@ impl Add<BigDigit> for BigUint {
 
     #[inline]
     fn add(mut self, other: BigDigit) -> BigUint {
-        if self.data.len() == 0 {
+        if self.data.len() == 0 && other != 0 {
             self.data.push(0);
         }