mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
BCD cleanup
Combine multiple BCD implementations. Signed-off-by: Paul Brook <paul@codesourcery.com>
This commit is contained in:
parent
a992fe3d0f
commit
abd0c6bda0
5 changed files with 79 additions and 98 deletions
|
@ -248,6 +248,17 @@ void qemu_iovec_from_buffer(QEMUIOVector *qiov, const void *buf, size_t count);
|
|||
struct Monitor;
|
||||
typedef struct Monitor Monitor;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
#include "module.h"
|
||||
|
||||
#endif /* dyngen-exec.h hack */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue