blob: 22ed6cebc519111dce66a2e38f4626dc2fab6384 [file] [log] [blame]
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05001/*
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 */
8struct BigNum;
9
10/* Remove multiples of a single number from the sieve */
11void
12sieveSingle(unsigned char *array, unsigned size, unsigned start, unsigned step);
13
14/* Build a sieve starting at the number and incrementing by "step". */
15int 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 */
19int 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) */
23unsigned sieveSearch(unsigned char const *array, unsigned size, unsigned start);