3 * - By John Hodge (thePowersGang)
12 #include <strings.h> // strcasecmp
14 // TODO: Move into a helper lib?
15 void itoa(char *buf, uint64_t num, int base, int minLength, char pad)
17 char fmt[] = "%0ll*x";
20 case 8: fmt[5] = 'o'; break;
21 case 10: fmt[5] = 'd'; break;
22 case 16: fmt[5] = 'x'; break;
26 sprintf(buf, fmt+1, minLength, num);
29 sprintf(buf, fmt, minLength, num);
33 int ParseInt(const char *string, int *value)
36 *value = strtol(string, &next, 0);
40 int strpos(const char *Str, char Ch)
42 const char *r = strchr(Str, Ch);
47 int strucmp(const char *s1, const char *s2)
49 return strcasecmp(s1, s2);
52 uint64_t DivMod64U(uint64_t value, uint64_t divisor, uint64_t *remainder)
55 *remainder = value % divisor;
56 return value / divisor;