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