-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathconstants.h
More file actions
70 lines (60 loc) · 2.9 KB
/
Copy pathconstants.h
File metadata and controls
70 lines (60 loc) · 2.9 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#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)
/* Sanna's upper bound proves nth_lucky(MPU_MAX_LUCKY_IDX) fits in a UV. */
/* Not exact. Largest UV we have not ruled out as lucky. */
#define MPU_MAX_LUCKY UVCONST(18446744073709551517) /* Maybe */
/* Not exact. Conservative index where nth-lucky upper bound fits in a UV. */
#define MPU_MAX_LUCKY_IDX UVCONST(336667000000000000)
#endif
#if HAVE_UINT64
#define MPU_MAX_PRIME64 ((uint64_t)UINT64_MAX - 58)
#endif
/* A hard limit for the random byte generation */
#define MAX_RANDOM_BYTES UVCONST(2147483646)
/* Our chosen maximum for random prime / bits generation */
#define MAX_RANDOM_BITS UVCONST(4294967295)
/* Maximum is identical for simplicity */
#define MAX_RANDOM_DIGITS MAX_RANDOM_BITS
/* Small table of primes; 0,2,3,5,7,... primes_small[n] is the nth prime.
* Defined in util.c; 306 entries (index 0 + primes 2..2011). */
#define NPRIMES_SMALL 306
extern const unsigned short primes_small[NPRIMES_SMALL];
/* Mod-30 mask for primes under 16384 */
#define NPRIME_SIEVE30 547
extern const unsigned char prime_sieve30[NPRIME_SIEVE30];
/****************************************************************************/
/* 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