Repository navigation
Commit a6965ff
Let compilers vectorize v_complement()
The two's complement of a digit vector is ~a + 1, and the +1 only carries
through the trailing zero digits: they stay zero, the first nonzero digit
is negated, and the digits above it are just inverted. Written that way
no carry is passed between loop iterations, so the loop can be vectorized.
v_complement() runs for every bitwise operation with a negative multi-digit
operand, up to three times per operation.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent 7f52444 commit a6965ff
1 file changed
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5552 | 5552 | | |
5553 | 5553 | | |
5554 | 5554 | | |
5555 | | - | |
5556 | | - | |
5557 | | - | |
5558 | | - | |
5559 | | - | |
5560 | | - | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
| 5560 | + | |
| 5561 | + | |
| 5562 | + | |
| 5563 | + | |
| 5564 | + | |
| 5565 | + | |
| 5566 | + | |
| 5567 | + | |
5561 | 5568 | | |
5562 | | - | |
5563 | 5569 | | |
5564 | 5570 | | |
5565 | 5571 | | |
| |||
0 commit comments