Zerocat Chipflasher  v0.4.3 (board-edition-1)
Flash free firmware to BIOS chips, kick the Manageability Engine.
hexdigit2bin.c
Go to the documentation of this file.
1 /******************************************************************/
28 /******************************************************************/
39 signed char hexdigit2bin (
40  unsigned char hexdigit
41  )
42 {
43  switch(hexdigit) {
44  case '0' ... '9':
45  return hexdigit - '0';
46 
47  case 'a' ... 'f':
48  case 'A' ... 'F':
49  return (hexdigit & ~0x20) - 'A' + 10; //convert lower to upper
50  }
51  return -1;
52 }
53 
54 
55 
hexdigit2bin
signed char hexdigit2bin(unsigned char hexdigit)
Convert a hexadecimal digit into a binary value.
Definition: hexdigit2bin.c:39