scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

_dtoi.c (239B)


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