forked from danaj/Math-Prime-Util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.h
48 lines (42 loc) · 2.05 KB
/
constants.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef MPU_CONSTANTS_H
#define MPU_CONSTANTS_H
#include "ptypes.h"
#if BITS_PER_WORD == 32
#define MPU_MAX_PRIME UVCONST(4294967291)
#define MPU_MAX_PRIME_IDX UVCONST(203280221)
#define MPU_MAX_TWIN_PRIME UVCONST(4294965839)
#define MPU_MAX_TWIN_PRIME_IDX UVCONST(12739574)
#define MPU_MAX_RMJN_PRIME UVCONST(4294967279)
#define MPU_MAX_RMJN_PRIME_IDX UVCONST(98182656)
#define MPU_MAX_SEMI_PRIME UVCONST(4294967294)
#define MPU_MAX_SEMI_PRIME_IDX UVCONST(658662065)
#define MPU_MAX_POW3 20
#define MPU_MAX_PERFECT_POW UVCONST(4294836225)
#define MPU_MAX_PERFECT_POW_IDX UVCONST(67226)
#define MPU_MAX_LUCKY UVCONST(4294967275)
#define MPU_MAX_LUCKY_IDX UVCONST(186812128)
#else
#define MPU_MAX_PRIME UVCONST(18446744073709551557)
#define MPU_MAX_PRIME_IDX UVCONST(425656284035217743)
#define MPU_MAX_TWIN_PRIME UVCONST(18446744073709550771)
#define MPU_MAX_TWIN_PRIME_IDX UVCONST(12975810317986308) /* Approx */
#define MPU_MAX_RMJN_PRIME UVCONST(18446744073709550771) /* Not correct */
#define MPU_MAX_RMJN_PRIME_IDX UVCONST(12975810317986308) /* Not correct */
#define MPU_MAX_SEMI_PRIME UVCONST(18446744073709551601)
#define MPU_MAX_SEMI_PRIME_IDX UVCONST(1701748900850019777)
#define MPU_MAX_POW3 40
#define MPU_MAX_PERFECT_POW UVCONST(18446744065119617025)
#define MPU_MAX_PERFECT_POW_IDX UVCONST(4297615581)
/* Max Lucky Tested through 200000000000, but need to 394961521040845441. */
#define MPU_MAX_LUCKY UVCONST(18446744073709551517) /* Maybe */
#define MPU_MAX_LUCKY_IDX UVCONST(395236168661920929) /* Not correct */
#endif
/****************************************************************************/
/* Configuration */
/* To avoid thrashing, sieve a little farther than needed */
#define _MPU_FILL_EXTRA_N (128*30)
/* The initial cache size. 30k primes per 1k of cache. */
#define _MPU_INITIAL_CACHE_SIZE ((4096-16)*30 - _MPU_FILL_EXTRA_N)
/* Where to start using LMO instead of segment sieve */
#define _MPU_LMO_CROSSOVER 66000000
#endif