blob: ebb6e02d60d3d575addea309f2abc31e11e2d7dd [file] [log] [blame]
/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */
#ifndef _BCD_H_
#define _BCD_H_
#include <stdint.h>
static inline uint8_t bcd2bin(uint8_t val)
{
return ((val >> 4) & 0xf) * 10 + (val & 0xf);
}
static inline uint8_t bin2bcd(uint8_t val)
{
return ((val / 10) << 4) | (val % 10);
}
#endif /* _BCD_H_ */