mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 13:30:52 +00:00
175de52487
Cleaned up with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
16 lines
276 B
C
16 lines
276 B
C
#ifndef QEMU_BCD_H
|
|
#define QEMU_BCD_H
|
|
|
|
/* Convert a byte between binary and BCD. */
|
|
static inline uint8_t to_bcd(uint8_t val)
|
|
{
|
|
return ((val / 10) << 4) | (val % 10);
|
|
}
|
|
|
|
static inline uint8_t from_bcd(uint8_t val)
|
|
{
|
|
return ((val >> 4) * 10) + (val & 0x0f);
|
|
}
|
|
|
|
#endif
|