42 return byte + (6 * (
byte / 10));
55 return bcd - (6 * (bcd >> 4));
109 void *dst,
size_t dst_len);
uint32_t bcd_buf_to_u32(const void *src, size_t len)
Convert a BCD buffer into it's binary representation (This will reverse bcd_buf_from_u32)
static uint8_t bcd_to_byte(uint8_t bcd)
Converts a binary coded decimal to a byte.
int bcd_buf_from_u32(uint32_t val, void *dst, size_t len)
Convert a decimal value into a BCD buffer.
static uint8_t bcd_from_byte(uint8_t byte)
Converts a byte to a binary coded decimal.
int bcd_buf_from_str(const char *str, size_t str_len, void *dst, size_t dst_len)
Convert a string into a BCD buffer Digits may be separated by any character.
uint64_t bcd_buf_to_u64(const void *src, size_t len)
Convert a BCD buffer into it's binary representation.