repo.or.cz
/
qemu
/
ar7.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
meson: fix module config
[qemu/ar7.git]
/
target
/
ppc
/
mfrom_table_gen.c
blob
f96c4268ba7043466a66e87d4180571252ac47d1
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
/*
14
* Extremely 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
}
31
printf
(
"
\n
};
\n
"
);
32
33
return
0
;
34
}