-
Notifications
You must be signed in to change notification settings - Fork 75
Speedups for Uint::sqrt, Uint::sqrt_vartime
#1078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1078 +/- ##
==========================================
- Coverage 78.76% 78.76% -0.01%
==========================================
Files 173 173
Lines 17741 17750 +9
==========================================
+ Hits 13974 13980 +6
- Misses 3767 3770 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
It might be clearer having the methods named |
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
|
@andrewwhitehead or |
|
@tarcieri There is precedent for
|
|
@andrewwhitehead those all sound like reasonably good ideas to me. Do you want to open a separate issue for it? It would also be interesting to impl such traits for modular sqrt, at least for |
These changes optimize
Uint::sqrtby operating on a non-zero input, reducing the number of conditional selects. The initial division operation for bothsqrtandsqrt_vartimeis replaced by a bit shift. A fast path is added forsqrt_vartimewhen the input fits within a Limb.Sample benchmarks: