2
0

sieve.h 1.0 KB

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 1995 Colin Plumb. All rights reserved.
  3. * For licensing and other legal details, see the file legal.c.
  4. *
  5. * sieve.h - Trial division for prime finding.
  6. *
  7. * This is generally not intended for direct use by a user of the library;
  8. * the prime.c and dhprime.c functions. are more likely to be used.
  9. * However, a special application may need these.
  10. */
  11. struct BigNum;
  12. /* Remove multiples of a single number from the sieve */
  13. void
  14. sieveSingle(unsigned char *array, unsigned size, unsigned start, unsigned step);
  15. /* Build a sieve starting at the number and incrementing by "step". */
  16. int sieveBuild(unsigned char *array, unsigned size, struct BigNum const *bn,
  17. unsigned step, unsigned dbl);
  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. /* Return the next bit set in the sieve (or 0 on failure) */
  22. unsigned sieveSearch(unsigned char const *array, unsigned size, unsigned start);