source:
git/factory/cf_primes.cc
@
243019
Last change on this file since 243019 was 9f7665, checked in by , 10 years ago | |
---|---|
|
|
File size: 806 bytes |
Rev | Line | |
---|---|---|
[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
[2dd068] | 2 | |
[9f7665] | 3 | |
[e4fe2b] | 4 | #include "config.h" |
[9f7665] | 5 | |
[b973c0] | 6 | |
[650f2d8] | 7 | #include "cf_assert.h" |
[b973c0] | 8 | |
[2dd068] | 9 | #include "cf_defs.h" |
10 | #include "cf_primes.h" | |
[cc2b49] | 11 | #include "cf_primetab.h" |
[2dd068] | 12 | |
13 | ||
14 | int cf_getPrime( int i ) | |
15 | { | |
[35930b] | 16 | ASSERT( i >= 0 && i < NUMPRIMES, "index to primes too high" ); |
[cc2b49] | 17 | if ( i >= NUMSMALLPRIMES ) |
[806c18] | 18 | return bigprimes[i-NUMSMALLPRIMES]; |
[cc2b49] | 19 | else |
[806c18] | 20 | return smallprimes[i]; |
[2dd068] | 21 | } |
22 | ||
23 | int cf_getNumPrimes() | |
24 | { | |
[35930b] | 25 | return NUMPRIMES; |
[2dd068] | 26 | } |
27 | ||
28 | int cf_getSmallPrime( int i ) | |
29 | { | |
[cc2b49] | 30 | ASSERT( i >= 0 && i < NUMSMALLPRIMES, "index to primes too high" ); |
31 | return smallprimes[i]; | |
[2dd068] | 32 | } |
33 | ||
34 | int cf_getNumSmallPrimes() | |
35 | { | |
[cc2b49] | 36 | return NUMSMALLPRIMES; |
[2dd068] | 37 | } |
38 | ||
39 | int cf_getBigPrime( int i ) | |
40 | { | |
41 | ASSERT( i >= 0 && i < NUMBIGPRIMES, "index to primes too high" ); | |
[cc2b49] | 42 | return bigprimes[i]; |
[2dd068] | 43 | } |
44 | ||
45 | int cf_getNumBigPrimes() | |
46 | { | |
[cc2b49] | 47 | return NUMBIGPRIMES; |
[2dd068] | 48 | } |
Note: See TracBrowser
for help on using the repository browser.