Commit b63412e
committed
Hashtable: Extend nextPrime() to support 64-bit size range
Extend the nextPrime() function so that it can report primes up to
(2^63 - 25).
The old prime number sequence stops at (2^37 - 25). Although it's
possible to extend the sequence https://oeis.org/A014234 to support
up to 2^63, the code size can be smaller by encoding the differences to
the prime numbers (i.e. the sequence https://oeis.org/A013603 ) as the
array instead.
The next prime in the sequence, (2^64 - 59), is not useful for the
Hashtable purpose (and it exceeds SSIZE_MAX) and so is left out.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>1 parent ab3192e commit b63412e
1 file changed
Lines changed: 15 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | 92 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
0 commit comments