repo.or.cz
/
qemu
/
kevin.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
nbd: Avoid magic number for NBD max name size
[qemu/kevin.git]
/
target-ppc
/
mfrom_table_gen.c
blob
631791808e89b0ff4abd57740f4016ac1f7fc362
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
}