qemu-patch-raspberry4/include/qemu/bcd.h
Veronia Bahaa f348b6d1a5 util: move declarations out of qemu-common.h
Move declarations out of qemu-common.h for functions declared in
utils/ files: e.g. include/qemu/path.h for utils/path.c.
Move inline functions out of qemu-common.h and into new files (e.g.
include/qemu/bcd.h)

Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-22 22:20:17 +01:00

16 lines
278 B
C

#ifndef QEMU_BCD_H
#define QEMU_BCD_H 1
/* 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