diff options
Diffstat (limited to 'app/util.c')
-rw-r--r-- | app/util.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -55,3 +55,13 @@ unsigned le_bcd (uint8_t *d, unsigned s, unsigned e) } +unsigned xtoi (char c) +{ + if ((c >= '0') && (c <= '9')) return c - '0'; + + if ((c >= 'a') && (c <= 'f')) return 0xa + (c - 'a'); + + if ((c >= 'A') && (c <= 'F')) return 0xA + (c - 'A'); + + return 0; +} |