hexDigit method

int hexDigit(
  1. int c
)

Implementation

int hexDigit(int c) {
  if ( c >= 48 ) {
    if ( c <= 57 ) {
      return c - 48;
    }
  }
  if ( c >= 97 ) {
    if ( c <= 102 ) {
      return (c - 97) + 10;
    }
  }
  if ( c >= 65 ) {
    if ( c <= 70 ) {
      return (c - 65) + 10;
    }
  }
  return 0;
}