]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/bcd.h
hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend()
[mirror_qemu.git] / include / qemu / bcd.h
CommitLineData
f348b6d1 1#ifndef QEMU_BCD_H
175de524 2#define QEMU_BCD_H
f348b6d1
VB
3
4/* Convert a byte between binary and BCD. */
5static inline uint8_t to_bcd(uint8_t val)
6{
7 return ((val / 10) << 4) | (val % 10);
8}
9
10static inline uint8_t from_bcd(uint8_t val)
11{
12 return ((val >> 4) * 10) + (val & 0x0f);
13}
14
15#endif