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