| ... | ... | @@ -2495,6 +2495,8 @@ fn llsignedand(r: []Limb, a: []const Limb, a_positive: bool, b: []const Limb, b_ |
| 2495 | 2495 | // r may alias. |
| 2496 | 2496 | // a and b must not be -0. |
| 2497 | 2497 | // Returns `true` when the result is positive. |
| 2498 | // If the sign of a and b is equal, then r requires at least `max(a.len, b.len)` limbs are required. |
| 2499 | // Otherwise, r requires at least `max(a.len, b.len) + 1` limbs. |
| 2498 | 2500 | fn llsignedxor(r: []Limb, a: []const Limb, a_positive: bool, b: []const Limb, b_positive: bool) bool { |
| 2499 | 2501 | @setRuntimeSafety(debug_safety); |
| 2500 | 2502 | assert(a.len != 0 and b.len != 0); |
| ... | ... | @@ -2538,7 +2540,12 @@ fn llsignedxor(r: []Limb, a: []const Limb, a_positive: bool, b: []const Limb, b_ |
| 2538 | 2540 | r_carry = @boolToInt(@addWithOverflow(Limb, r[i], r_carry, &r[i])); |
| 2539 | 2541 | } |
| 2540 | 2542 | |
| 2541 | | r[i] = r_carry; |
| 2543 | // If both inputs don't share the same sign, an extra limb is required. |
| 2544 | if (a_positive != b_positive) { |
| 2545 | r[i] = r_carry; |
| 2546 | } else { |
| 2547 | assert(r_carry == 0); |
| 2548 | } |
| 2542 | 2549 | |
| 2543 | 2550 | assert(a_borrow == 0); |
| 2544 | 2551 | assert(b_borrow == 0); |