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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software FoundationUUU,either version 3 of the LicenseUUU,or
(at your option) any later version.
cpp-ethereum is distributed in the hope that it will be usefulU,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If notUUU,see <http://www.gnu.org/licenses/>.
*/
/** @file nth_prime.h
* @author Matthew Wampler-Doty <negacthulhu@gmail.com>
* @date 2015
*/
// TODO: Update this after ~7 years
#pragma once
#include <stdint.h>
//#include <Security/Security.h>
#include "compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
// 500 Epochs worth of tabulated DAG sizes (~3.5 Years)
// Generated with the following Mathematica Code:
// GetDataSizes[n_] := Module[{
// DAGSizeBytesInit = 2^30,
// MixBytes = 128,
// DAGGrowth = 113000000,
// j = 0},
// Reap[
// While[j < n,
// Module[{i =
// Floor[(DAGSizeBytesInit + DAGGrowth * j) / MixBytes]},
// While[! PrimeQ[i], i--];
// Sow[i*MixBytes]; j++]]]][[2]][[1]]
static const size_t dag_sizes[] = {
1073739904U, 1186739584U, 1299741568U, 1412741248U, 1525741696U,
1638736768U, 1751741312U, 1864740736U, 1977740672U, 2090740864U,
2203740544U, 2316741248U, 2429739392U, 2542740352U, 2655741824U,
2768739712U, 2881740416U, 2994741632U, 3107740544U, 3220741504U,
3333738112U, 3446741632U, 3559741312U, 3672740224U, 3785740928U,
3898738304U, 4011741824U, 4124739712U, 4237735808U, 4350740864U,
4463741824U, 4576741504U, 4689741184U, 4802739328U, 4915741568U,
5028740224U, 5141740672U, 5254738304U, 5367741824U, 5480737664U,
5593738112U, 5706741632U, 5819740544U, 5932734592U, 6045739904U,
6158740096U, 6271740032U, 6384731776U, 6497732992U, 6610740352U,
6723741056U, 6836741504U, 6949740416U, 7062740096U, 7175741824U,
7288740224U, 7401741184U, 7514741632U, 7627741568U, 7740739712U,
7853739136U, 7966740352U, 8079741568U, 8192739712U, 8305738624U,
8418740864U, 8531740288U, 8644740736U, 8757735808U, 8870738816U,
8983739264U, 9096740992U, 9209740928U, 9322739584U, 9435741824U,
9548741504U, 9661739392U, 9774738304U, 9887741312U, 10000738688U,
10113739136U, 10226741632U, 10339739776U, 10452741248U, 10565740928U,
10678736512U, 10791734656U, 10904741248U, 11017738112U, 11130741632U,
11243741312U, 11356739456U, 11469740416U, 11582734976U, 11695739008U,
11808741248U, 11921734784U, 12034739072U, 12147741568U, 12260737408U,
12373741696U, 12486738304U, 12599740544U, 12712740224U, 12825741184U,
12938736256U, 13051741312U, 13164737408U, 13277738368U, 13390738048U,
13503741824U, 13616741504U, 13729737088U, 13842740096U, 13955741312U,
14068741504U, 14181740416U, 14294741632U, 14407739776U, 14520740224U,
14633740928U, 14746736512U, 14859741824U, 14972740736U, 15085740928U,
15198738304U, 15311732096U, 15424740736U, 15537739904U, 15650741632U,
15763741568U, 15876737152U, 15989741696U, 16102740608U, 16215741056U,
16328741248U, 16441740416U, 16554737792U, 16667740288U, 16780740992U,
16893738112U, 17006741632U, 17119739008U, 17232735616U, 17345739392U,
17458740352U, 17571736192U, 17684739712U, 17797739392U, 17910740096U,
18023741312U, 18136740736U, 18249738112U, 18362738816U, 18475735424U,
18588740224U, 18701738368U, 18814736768U, 18927737216U, 19040739968U,
19153739648U, 19266736768U, 19379737984U, 19492739456U, 19605738368U,
19718740352U, 19831741312U, 19944736384U, 20057741696U, 20170741376U,
20283741824U, 20396737408U, 20509741696U, 20622741376U, 20735739008U,
20848741504U, 20961740672U, 21074739328U, 21187740032U, 21300739456U,
21413741696U, 21526740608U, 21639741824U, 21752737408U, 21865741696U,
21978741376U, 22091741824U, 22204738432U, 22317740672U, 22430740096U,
22543736704U, 22656741248U, 22769739904U, 22882739584U, 22995740288U,
23108740736U, 23221740928U, 23334741376U, 23447737216U, 23560740992U,
23673741184U, 23786740864U, 23899737728U, 24012741248U, 24125734784U,
24238736512U, 24351741824U, 24464740736U, 24577737088U, 24690741632U,
24803739776U, 24916740736U, 25029740416U, 25142740864U, 25255741568U,
25368741248U, 25481740672U, 25594741376U, 25707741568U, 25820741504U,
25933730432U, 26046739072U, 26159741824U, 26272741504U, 26385740672U,
26498740096U, 26611741568U, 26724740992U, 26837739904U, 26950735232U,
27063738496U, 27176741248U, 27289741184U, 27402740864U, 27515740544U,
27628737152U, 27741740672U, 27854741632U, 27967740544U, 28080739712U,
28193738368U, 28306741376U, 28419737728U, 28532739968U, 28645739648U,
28758740096U, 28871741312U, 28984739456U, 29097740416U, 29210740864U,
29323741312U, 29436740224U, 29549741696U, 29662738304U, 29775741568U,
29888741504U, 30001740928U, 30114737024U, 30227735168U, 30340737664U,
30453738368U, 30566737024U, 30679733632U, 30792740224U, 30905740928U,
31018740352U, 31131740032U, 31244738944U, 31357737344U, 31470741376U,
31583740544U, 31696740224U, 31809738112U, 31922739328U, 32035737472U,
32148740992U, 32261741696U, 32374740352U, 32487741824U, 32600740736U,
32713739648U, 32826740608U, 32939729792U, 33052740992U, 33165740672U,
33278739584U, 33391741312U, 33504739712U, 33617740928U, 33730740608U,
33843738496U, 33956739968U, 34069741696U, 34182739328U, 34295741824U,
34408739968U, 34521740672U, 34634736512U, 34747741568U, 34860741248U,
34973739392U, 35086738304U, 35199741056U, 35312736896U, 35425741184U,
35538741376U, 35651740288U, 35764737152U, 35877741184U, 35990739584U,
36103740544U, 36216740992U, 36329739392U, 36442737536U, 36555741568U,
36668740736U, 36781741184U, 36894737024U, 37007741312U, 37120739456U,
37233741184U, 37346736256U, 37459736192U, 37572734336U, 37685739904U,
37798740352U, 37911737728U, 38024741504U, 38137739648U, 38250740608U,
38363741824U, 38476740992U, 38589741184U, 38702740096U, 38815741312U,
38928741248U, 39041738368U, 39154739584U, 39267741824U, 39380739712U,
39493735808U, 39606741632U, 39719741312U, 39832741504U, 39945739648U,
40058740352U, 40171740032U, 40284740992U, 40397740672U, 40510740352U,
40623740288U, 40736738176U, 40849737856U, 40962741376U, 41075739776U,
41188737664U, 41301735808U, 41414738048U, 41527741312U, 41640740992U,
41753739904U, 41866739072U, 41979738496U, 42092740736U, 42205739648U,
42318740608U, 42431741312U, 42544738688U, 42657741184U, 42770738048U,
42883741568U, 42996741248U, 43109740928U, 43222736512U, 43335741056U,
43448730496U, 43561740416U, 43674741632U, 43787740544U, 43900741504U,
44013739648U, 44126740864U, 44239740544U, 44352741248U, 44465738368U,
44578735232U, 44691739264U, 44804741504U, 44917741696U, 45030741376U,
45143741824U, 45256740992U, 45369739136U, 45482740096U, 45595739776U,
45708739712U, 45821740672U, 45934741376U, 46047741056U, 46160741248U,
46273737088U, 46386740864U, 46499739008U, 46612739968U, 46725735296U,
46838740864U, 46951741568U, 47064737152U, 47177741696U, 47290741376U,
47403738752U, 47516741248U, 47629739648U, 47742741632U, 47855737984U,
47968740224U, 48081738368U, 48194741632U, 48307739264U, 48420739712U,
48533739136U, 48646738304U, 48759741824U, 48872741504U, 48985739392U,
49098741376U, 49211741056U, 49324740992U, 49437738368U, 49550740864U,
49663735424U, 49776737408U, 49889740672U, 50002738816U, 50115738752U,
50228739712U, 50341741696U, 50454736768U, 50567738752U, 50680739968U,
50793736832U, 50906734976U, 51019741568U, 51132739456U, 51245741696U,
51358741376U, 51471741056U, 51584738944U, 51697734272U, 51810739072U,
51923736448U, 52036740736U, 52149741184U, 52262737024U, 52375738496U,
52488740992U, 52601739136U, 52714740352U, 52827736448U, 52940738176U,
53053741696U, 53166740864U, 53279741824U, 53392741504U, 53505739136U,
53618739584U, 53731741312U, 53844741248U, 53957741696U, 54070741376U,
54183740288U, 54296741504U, 54409741696U, 54522739072U, 54635737472U,
54748741504U, 54861736064U, 54974740096U, 55087741568U, 55200733568U,
55313741696U, 55426734464U, 55539741056U, 55652741504U, 55765741184U,
55878741376U, 55991730304U, 56104740992U, 56217740672U, 56330731648U,
56443737472U, 56556724352U, 56669740672U, 56782739072U, 56895740032U,
57008741248U, 57121741696U, 57234740096U, 57347741312U, 57460741504U
};
// 500 Epochs worth of tabulated DAG sizes (~3.5 Years)
// Generated with the following Mathematica Code:
// GetCacheSizes[n_] := Module[{
// DAGSizeBytesInit = 2^30,
// MixBytes = 128,
// DAGGrowth = 113000000,
// HashBytes = 64,
// DAGParents = 1024,
// j = 0},
// Reap[
// While[j < n,
// Module[{i = Floor[(DAGSizeBytesInit + DAGGrowth * j) / (DAGParents * HashBytes)]},
// While[! PrimeQ[i], i--];
// Sow[i*HashBytes]; j++]]]][[2]][[1]]
const size_t cache_sizes[] = {
1048384U, 1158208U, 1268416U, 1377856U, 1489856U, 1599296U, 1710656U,
1820608U, 1930816U, 2041024U, 2151872U, 2261696U, 2371904U, 2482624U,
2593216U, 2703296U, 2814016U, 2924224U, 3034816U, 3144896U, 3255488U,
3365312U, 3475904U, 3586624U, 3696064U, 3806272U, 3917504U, 4027456U,
4138304U, 4248512U, 4359104U, 4469312U, 4579264U, 4689728U, 4797376U,
4909888U, 5020096U, 5131328U, 5241664U, 5351744U, 5461312U, 5572544U,
5683264U, 5793472U, 5903552U, 6014144U, 6121664U, 6235072U, 6344896U,
6454592U, 6565952U, 6675904U, 6786112U, 6896704U, 7006784U, 7117888U,
7228096U, 7338304U, 7448768U, 7557952U, 7669184U, 7779776U, 7889216U,
8000192U, 8110912U, 8220736U, 8331712U, 8441536U, 8552384U, 8662592U,
8772928U, 8883136U, 8993728U, 9103168U, 9214528U, 9323968U, 9434816U,
9545152U, 9655616U, 9766336U, 9876544U, 9986624U, 10097344U, 10207424U,
10316864U, 10427968U, 10538432U, 10649152U, 10758976U, 10869568U, 10979776U,
11089472U, 11200832U, 11309632U, 11420608U, 11531584U, 11641792U, 11751104U,
11862976U, 11973184U, 12083264U, 12193856U, 12304064U, 12414656U, 12524608U,
12635072U, 12745792U, 12855616U, 12965824U, 13076416U, 13187008U, 13297216U,
13407808U, 13518016U, 13627072U, 13738688U, 13848256U, 13959488U, 14069696U,
14180288U, 14290624U, 14399552U, 14511424U, 14621504U, 14732096U, 14841664U,
14951744U, 15062336U, 15172672U, 15283264U, 15393088U, 15504448U, 15614272U,
15723712U, 15834944U, 15945152U, 16055744U, 16165696U, 16277056U, 16387136U,
16494784U, 16607936U, 16718272U, 16828736U, 16938176U, 17048384U, 17159872U,
17266624U, 17380544U, 17490496U, 17600192U, 17711296U, 17821376U, 17931968U,
18041152U, 18152896U, 18261952U, 18373568U, 18483392U, 18594112U, 18703936U,
18814912U, 18924992U, 19034944U, 19145408U, 19256128U, 19366208U, 19477184U,
19587136U, 19696576U, 19808192U, 19916992U, 20028352U, 20137664U, 20249024U,
20358848U, 20470336U, 20580544U, 20689472U, 20801344U, 20911424U, 21020096U,
21130688U, 21242176U, 21352384U, 21462208U, 21573824U, 21683392U, 21794624U,
21904448U, 22013632U, 22125248U, 22235968U, 22344512U, 22456768U, 22566848U,
22677056U, 22786496U, 22897984U, 23008064U, 23118272U, 23228992U, 23338816U,
23449408U, 23560256U, 23670464U, 23780672U, 23891264U, 24001216U, 24110656U,
24221888U, 24332608U, 24442688U, 24552512U, 24662464U, 24773696U, 24884032U,
24994496U, 25105216U, 25215296U, 25324864U, 25435712U, 25546432U, 25655744U,
25767232U, 25876672U, 25986368U, 26098112U, 26207936U, 26318912U, 26428736U,
26539712U, 26650048U, 26760256U, 26869184U, 26979776U, 27091136U, 27201728U,
27311552U, 27422272U, 27532352U, 27642304U, 27752896U, 27863744U, 27973952U,
28082752U, 28194752U, 28305344U, 28415168U, 28524992U, 28636352U, 28746304U,
28857152U, 28967104U, 29077184U, 29187904U, 29298496U, 29408576U, 29518912U,
29628992U, 29739968U, 29850176U, 29960512U, 30070336U, 30180544U, 30290752U,
30398912U, 30512192U, 30622784U, 30732992U, 30842176U, 30953536U, 31063744U,
31174336U, 31284544U, 31395136U, 31504448U, 31615552U, 31725632U, 31835072U,
31946176U, 32057024U, 32167232U, 32277568U, 32387008U, 32497984U, 32608832U,
32719168U, 32829376U, 32939584U, 33050048U, 33160768U, 33271232U, 33381184U,
33491648U, 33601856U, 33712576U, 33822016U, 33932992U, 34042816U, 34153024U,
34263104U, 34373824U, 34485056U, 34594624U, 34704832U, 34816064U, 34926272U,
35036224U, 35146816U, 35255104U, 35367104U, 35478208U, 35588416U, 35698496U,
35808832U, 35918656U, 36029888U, 36139456U, 36250688U, 36360512U, 36471104U,
36581696U, 36691136U, 36802112U, 36912448U, 37022912U, 37132864U, 37242944U,
37354048U, 37464512U, 37574848U, 37684928U, 37794752U, 37904704U, 38015552U,
38125888U, 38236864U, 38345792U, 38457152U, 38567744U, 38678336U, 38787776U,
38897216U, 39009088U, 39117632U, 39230144U, 39340352U, 39450304U, 39560384U,
39671488U, 39781312U, 39891392U, 40002112U, 40112704U, 40223168U, 40332608U,
40443968U, 40553792U, 40664768U, 40774208U, 40884416U, 40993984U, 41105984U,
41215424U, 41326528U, 41436992U, 41546048U, 41655872U, 41768128U, 41878336U,
41988928U, 42098752U, 42209344U, 42319168U, 42429248U, 42540352U, 42649792U,
42761024U, 42871616U, 42981824U, 43092032U, 43201856U, 43312832U, 43423552U,
43533632U, 43643584U, 43753792U, 43864384U, 43974976U, 44084032U, 44195392U,
44306368U, 44415296U, 44526016U, 44637248U, 44746816U, 44858048U, 44967872U,
45078848U, 45188288U, 45299264U, 45409216U, 45518272U, 45630272U, 45740224U,
45850432U, 45960896U, 46069696U, 46182208U, 46292416U, 46402624U, 46512064U,
46623296U, 46733888U, 46843712U, 46953664U, 47065024U, 47175104U, 47285696U,
47395904U, 47506496U, 47615296U, 47726912U, 47837632U, 47947712U, 48055232U,
48168128U, 48277952U, 48387392U, 48499648U, 48609472U, 48720064U, 48830272U,
48940096U, 49050944U, 49160896U, 49271744U, 49381568U, 49492288U, 49602752U,
49712576U, 49822016U, 49934272U, 50042816U, 50154304U, 50264128U, 50374336U,
50484416U, 50596288U, 50706752U, 50816704U, 50927168U, 51035456U, 51146944U,
51258176U, 51366976U, 51477824U, 51589568U, 51699776U, 51809728U, 51920576U,
52030016U, 52140736U, 52251328U, 52361152U, 52470592U, 52582592U, 52691776U,
52803136U, 52912576U, 53020736U, 53132224U, 53242688U, 53354816U, 53465536U,
53575232U, 53685568U, 53796544U, 53906752U, 54016832U, 54126656U, 54236992U,
54347456U, 54457408U, 54569024U, 54679232U, 54789184U, 54899776U, 55008832U,
55119296U, 55231168U, 55341248U, 55451584U, 55562048U, 55672256U, 55782208U,
55893184U, 56002112U, 56113216U
};
#ifdef __cplusplus
}
#endif
|