Ejemplo n.º 1
0
static int __init parse_hex_byte(const char *b)
{
	int hi;
	int lo;

	hi = parse_hex_nibble(b[0]);
	lo = parse_hex_nibble(b[1]);

	if (hi < 0 || lo < 0)
		return -1;

	return (hi << 4) | lo;
}
Ejemplo n.º 2
0
uint8_t parse_hex8(const char* str) {
  uint8_t highNibble = parse_hex_nibble(str[0]);
  uint8_t lowNibble = parse_hex_nibble(str[1]);
  return (highNibble << 4) | lowNibble;
}