_dtoi.c (261B)
1 #include <ctype.h> 2 #include <limits.h> 3 #include <string.h> 4 5 #include "../libc.h" 6 7 int 8 _dtoi(char c) 9 { 10 static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 11 char *p; 12 13 if (p = strchr(digits, toupper(c))) 14 return p - digits; 15 16 return INT_MAX; 17 }