-
Notifications
You must be signed in to change notification settings - Fork 5
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
mpz_prevprime #10
mpz_prevprime #10
Conversation
for (i = 0; i < prime_limit; i++) | ||
{ | ||
unsigned r; | ||
/* FIXME: Reduce moduli + incr and store back, to allow for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested several versions of this and none of them were faster.
@@ -82,47 +122,54 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n) | |||
/* Compute residues modulo small odd primes */ | |||
moduli = TMP_SALLOC_TYPE (prime_limit * sizeof moduli[0], unsigned short); | |||
|
|||
for (;;) | |||
{ | |||
/* FIXME: Compute lazily? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this too and it's not useful, because to exit the lower loop you have to check each of these is non-zero, so there all need to be calculated, and reordering doesn't seem to help (as there is overhead in tracking if they are calculated)
8067ba0
to
36563f8
Compare
d70d088
to
7f563a4
Compare
280f583
to
21623db
Compare
A different version (much better) is close to being merged upstream. |
mpz_prevprime