-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_func.cpp
40 lines (33 loc) · 859 Bytes
/
gen_func.cpp
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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll st = 1LL << 10;
const ll ed = 1LL << 29;
vector<ll> sizes = {8};
void func_dec() {
for (auto &s: sizes) {
ll cur = st;
while (cur <= ed) {
printf("extern \"C\" void fun_%lld();\n", cur);
cur *= 2;
}
puts("");
}
}
void func_pointers() {
printf("static void (*funs[])(void) = {\n");
for (auto &s: sizes) {
ll cur = st;
while (cur <= ed) {
printf("\tfun_%lld,\n", cur);
cur *= 2;
}
puts("");
}
puts("};");
}
int main(int argc, char **argv) {
func_dec();
func_pointers();
return 0;
}