Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 1 | /* |
| 2 | * sieve.h - Trial division for prime finding. |
| 3 | * |
| 4 | * This is generally not intended for direct use by a user of the library; |
| 5 | * the prime.c and dhprime.c functions. are more likely to be used. |
| 6 | * However, a special application may need these. |
| 7 | */ |
| 8 | struct BigNum; |
| 9 | |
| 10 | /* Remove multiples of a single number from the sieve */ |
| 11 | void |
| 12 | sieveSingle(unsigned char *array, unsigned size, unsigned start, unsigned step); |
| 13 | |
| 14 | /* Build a sieve starting at the number and incrementing by "step". */ |
| 15 | int sieveBuild(unsigned char *array, unsigned size, struct BigNum const *bn, |
| 16 | unsigned step, unsigned dbl); |
| 17 | |
| 18 | /* Similar, but uses a >16-bit step size */ |
| 19 | int sieveBuildBig(unsigned char *array, unsigned size, struct BigNum const *bn, |
| 20 | struct BigNum const *step, unsigned dbl); |
| 21 | |
| 22 | /* Return the next bit set in the sieve (or 0 on failure) */ |
| 23 | unsigned sieveSearch(unsigned char const *array, unsigned size, unsigned start); |