coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
bcd.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 
3 #ifndef _BCD_H_
4 #define _BCD_H_
5 
6 #include <stdint.h>
7 
8 static inline uint8_t bcd2bin(uint8_t val)
9 {
10  return ((val >> 4) & 0xf) * 10 + (val & 0xf);
11 }
12 
13 static inline uint8_t bin2bcd(uint8_t val)
14 {
15  return ((val / 10) << 4) | (val % 10);
16 }
17 
18 #endif /* _BCD_H_ */
static uint8_t bin2bcd(uint8_t val)
Definition: bcd.h:13
static uint8_t bcd2bin(uint8_t val)
Definition: bcd.h:8
unsigned char uint8_t
Definition: stdint.h:8
u8 val
Definition: sys.c:300