]> Git Repo - qemu.git/blob - include/qemu/bcd.h
Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.1-sf0' into...
[qemu.git] / include / qemu / bcd.h
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
This page took 0.024348 seconds and 4 git commands to generate.