forked from xomniversex/foo_gep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcubic.cpp
More file actions
34 lines (26 loc) · 693 Bytes
/
cubic.cpp
File metadata and controls
34 lines (26 loc) · 693 Bytes
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
#include <stdio.h>
int main(void)
{
signed short cubic[514];
for (int i = 0; i <= 256; i++)
{
cubic [i] = -( i*i*i >> 14) + ( i*i >> 5) - (i << 2);
cubic [i + 257] = (3*i*i*i >> 14) - (5*i*i >> 6) + (1 << 11);
}
fputs("static short const cubic [514] =\n{", stdout);
for (unsigned i = 0; i < 257; i++)
{
if (!(i & 15)) fputs("\n", stdout);
fprintf(stdout, "%4i", cubic [i]);
fputs(",", stdout);
}
fputs("\n", stdout);
for (unsigned i = 0; i < 257; i++)
{
if (!(i & 15)) fputs("\n", stdout);
fprintf(stdout, "%4i", cubic [i + 257]);
if (i < 256) fputs(",", stdout);
}
fputs("\n};\n", stdout);
return 0;
}