home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / crypl200.zip / BNLIB / SIEVE.H < prev    next >
C/C++ Source or Header  |  1996-05-16  |  969b  |  32 lines

  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. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14. /* Remove multiples of a single number from the sieve */
  15. void
  16. sieveSingle(unsigned char *array, unsigned size, unsigned start, unsigned step);
  17.  
  18. /* Build a sieve starting at the number and incrementing by "step". */
  19. int sieveBuild(unsigned char *array, unsigned size, struct BigNum const *bn,
  20.     unsigned step, unsigned dbl);
  21.  
  22. /* Similar, but uses a >16-bit step size */
  23. int sieveBuildBig(unsigned char *array, unsigned size, struct BigNum const *bn,
  24.     struct BigNum const *step, unsigned dbl);
  25.  
  26. /* Return the next bit set in the sieve (or 0 on failure) */
  27. unsigned sieveSearch(unsigned char const *array, unsigned size, unsigned start);
  28.  
  29. #ifdef __cplusplus
  30. }
  31. #endif
  32.