coreboot/src/include/bcd.h
Angel Pons 32859fccc6 src/include: Use SPDX for GPL-2.0-only files
Done with sed and God Lines. Only done for C-like code for now.

Change-Id: I2fa3bad88bb5b068baa1cfc6bbcddaabb09da1c5
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40053
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
2020-04-05 17:45:17 +00:00

19 lines
352 B
C

/* 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_ */