vl: Table-based select_vgahw()
[qemu/ar7.git] / target-ppc / mfrom_table_gen.c
blob631791808e89b0ff4abd57740f4016ac1f7fc362
1 #define _GNU_SOURCE
2 #include "qemu/osdep.h"
3 #include <math.h>
5 int main (void)
7 double d;
8 uint8_t n;
9 int i;
11 printf("static const uint8_t mfrom_ROM_table[602] =\n{\n ");
12 for (i = 0; i < 602; i++) {
13 /* Extremely decomposed:
14 * -T0 / 256
15 * T0 = 256 * log10(10 + 1.0) + 0.5
17 d = -i;
18 d /= 256.0;
19 d = exp10(d);
20 d += 1.0;
21 d = log10(d);
22 d *= 256;
23 d += 0.5;
24 n = d;
25 printf("%3d, ", n);
26 if ((i & 7) == 7)
27 printf("\n ");
29 printf("\n};\n");
31 return 0;