File:  [Qemu by Fabrice Bellard] / qemu / target-ppc / mfrom_table_gen.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:49:03 2018 UTC (3 years, 5 months ago) by root
Branches: qemu, MAIN
CVS tags: qemu1001, qemu1000, qemu0151, qemu0150, qemu0141, qemu0140, qemu0130, qemu0125, qemu0124, qemu0123, qemu0122, qemu0121, qemu0120, qemu0111, qemu0110, qemu0105, qemu0104, qemu0103, qemu0102, qemu0101, qemu0100, qemu0091, HEAD
qemu 0.9.1

    1: #define _GNU_SOURCE
    2: #include <stdint.h>
    3: #include <stdio.h>
    4: #include <math.h>
    5: 
    6: int main (void)
    7: {
    8:     double d;
    9:     uint8_t n;
   10:     int i;
   11: 
   12:     printf("static const uint8_t mfrom_ROM_table[602] =\n{\n    ");
   13:     for (i = 0; i < 602; i++) {
   14:         /* Extremly decomposed:
   15:          *                    -T0 / 256
   16:          * T0 = 256 * log10(10          + 1.0) + 0.5
   17:          */
   18:         d = -i;
   19:         d /= 256.0;
   20:         d = exp10(d);
   21:         d += 1.0;
   22:         d = log10(d);
   23:         d *= 256;
   24:         d += 0.5;
   25:         n = d;
   26:         printf("%3d, ", n);
   27:         if ((i & 7) == 7)
   28:             printf("\n    ");
   29:     }
   30:     printf("\n};\n");
   31: 
   32:     return 0;
   33: }

unix.superglobalmegacorp.com