perf: use width-8 NAF for static scalars to match NafLookupTable8 #848
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The precomputed Straus implementations for both the vector and serial backends build NafLookupTable8 for static points, which stores odd multiples up to 127A, but they decomposed static scalars with a width-5 NAF, restricting lookups to 1..15 and leaving most of the table unused. This change switches static scalar decomposition to non_adjacent_form(8), fully utilizing the 64-entry odd table. It reduces the number of static additions due to the lower nonzero digit density of width-8 NAF while keeping the number of doublings and the memory footprint unchanged, since the larger table was already computed. The change is safe because Scalar::non_adjacent_form supports w<=8 and NafLookupTable8::select requires odd digits less than 128, and it matches the existing pattern in vartime double-base multiplication where width 8 is used when a large odd-multiples table is available. No API or behavioral changes beyond this decomposition width are introduced.