These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / target-ppc / mfrom_table_gen.c
1 #define _GNU_SOURCE
2 #include "qemu/osdep.h"
3 #include <math.h>
4
5 int main (void)
6 {
7     double d;
8     uint8_t n;
9     int i;
10
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
16          */
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    ");
28     }
29     printf("\n};\n");
30
31     return 0;
32 }