sieve.h
Upload User: zbbssh
Upload Date: 2007-01-08
Package Size: 196k
Code Size: 1k
Category:

CA program

Development Platform:

C/C++

  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. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  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);
  23. #ifdef __cplusplus
  24. }
  25. #endif