| ... | @@ -1096,7 +1096,7 @@ pub const Mutable = struct { | ... | @@ -1096,7 +1096,7 @@ pub const Mutable = struct { |
| 1096 | /// Asserts there is enough memory to fit the result. The upper bound Limb count is | 1096 | /// Asserts there is enough memory to fit the result. The upper bound Limb count is |
| 1097 | /// `a.limbs.len + (shift / (@sizeOf(Limb) * 8))`. | 1097 | /// `a.limbs.len + (shift / (@sizeOf(Limb) * 8))`. |
| 1098 | pub fn shiftLeft(r: *Mutable, a: Const, shift: usize) void { | 1098 | pub fn shiftLeft(r: *Mutable, a: Const, shift: usize) void { |
| 1099 | llshl(r.limbs[0..], a.limbs[0..a.limbs.len], shift); | 1099 | llshl(r.limbs, a.limbs, shift); |
| 1100 | r.normalize(a.limbs.len + (shift / limb_bits) + 1); | 1100 | r.normalize(a.limbs.len + (shift / limb_bits) + 1); |
| 1101 | r.positive = a.positive; | 1101 | r.positive = a.positive; |
| 1102 | } | 1102 | } |
| ... | @@ -1165,7 +1165,7 @@ pub const Mutable = struct { | ... | @@ -1165,7 +1165,7 @@ pub const Mutable = struct { |
| 1165 | | 1165 | |
| 1166 | // This shift should not be able to overflow, so invoke llshl and normalize manually | 1166 | // This shift should not be able to overflow, so invoke llshl and normalize manually |
| 1167 | // to avoid the extra required limb. | 1167 | // to avoid the extra required limb. |
| 1168 | llshl(r.limbs[0..], a.limbs[0..a.limbs.len], shift); | 1168 | llshl(r.limbs, a.limbs, shift); |
| 1169 | r.normalize(a.limbs.len + (shift / limb_bits)); | 1169 | r.normalize(a.limbs.len + (shift / limb_bits)); |
| 1170 | r.positive = a.positive; | 1170 | r.positive = a.positive; |
| 1171 | } | 1171 | } |
| ... | @@ -1202,17 +1202,11 @@ pub const Mutable = struct { | ... | @@ -1202,17 +1202,11 @@ pub const Mutable = struct { |
| 1202 | break :nonzero a.limbs[full_limbs_shifted_out] << not_covered != 0; | 1202 | break :nonzero a.limbs[full_limbs_shifted_out] << not_covered != 0; |
| 1203 | }; | 1203 | }; |
| 1204 | | 1204 | |
| 1205 | llshr(r.limbs[0..], a.limbs[0..a.limbs.len], shift); | 1205 | llshr(r.limbs, a.limbs, shift); |
| 1206 | | 1206 | |
| 1207 | r.len = a.limbs.len - full_limbs_shifted_out; | 1207 | r.len = a.limbs.len - full_limbs_shifted_out; |
| 1208 | r.positive = a.positive; | 1208 | r.positive = a.positive; |
| 1209 | if (nonzero_negative_shiftout) { | 1209 | if (nonzero_negative_shiftout) r.addScalar(r.toConst(), -1); |
| 1210 | if (full_limbs_shifted_out > 0) { | | |
| 1211 | r.limbs[a.limbs.len - full_limbs_shifted_out] = 0; | | |
| 1212 | r.len += 1; | | |
| 1213 | } | | |
| 1214 | r.addScalar(r.toConst(), -1); | | |
| 1215 | } | | |
| 1216 | r.normalize(r.len); | 1210 | r.normalize(r.len); |
| 1217 | } | 1211 | } |
| 1218 | | 1212 | |