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
Merge remote-tracking branch 'remotes/elmarco/tags/leak-pull-request' into staging
[qemu/ar7.git]
/
include
/
qemu
/
bcd.h
blob
dfebacf1fc38a82d8375632a66494636e2288287
1
#ifndef QEMU_BCD_H
2
#define QEMU_BCD_H
3
4
/* Convert a byte between binary and BCD. */
5
static
inline
uint8_t
to_bcd
(
uint8_t
val
)
6
{
7
return
((
val
/
10
) <<
4
) | (
val
%
10
);
8
}
9
10
static
inline
uint8_t
from_bcd
(
uint8_t
val
)
11
{
12
return
((
val
>>
4
) *
10
) + (
val
&
0x0f
);
13
}
14
15
#endif