Utility.c 204 B

12345678
  1. #include "Utility.h"
  2. int hex_to_int(char c) {
  3. if (c >= '0' && c <= '9') return c - '0';
  4. if (c >= 'a' && c <= 'f') return c - 'a' + 10;
  5. if (c >= 'A' && c <= 'F') return c - 'A' + 10;
  6. return -1;
  7. }