forked from len0rd/rockbox
in testing of three ways of doing this current: ((_ctype_+1)[(unsigned char)(c)]&_N) alt1(this patch): (((unsigned int) (c) - '0') < 10) alt2: ((unsigned int)(c ^ 0x30) < 10) alt1 and alt2 are the same in terms of speed and instructions (on arm v7) but alt2 has one more instruction on mips (across several archs in godbolt mips, armv7v8, x86) and on ARM7 (clipzip) device about 9% faster less false positives for both alt1 and 2 when you start supplying more than 8bits not sure if that matters in practice though I tried similar with isxdigit but could only get to within 1 instruction of the ctype implementation although it negated the array lookup I saw no discernable speed difference on device https://godbolt.org/z/qGvh4hqnG Change-Id: I5c9e8fd3915709853e0e33427038e20a068058b6 |
||
---|---|---|
.. | ||
include | ||
atoi.c | ||
ctype.c | ||
errno.c | ||
gmtime.c | ||
memccpy.c | ||
memchr.c | ||
memcmp.c | ||
mktime.c | ||
qsort.c | ||
random.c | ||
sprintf.c | ||
sscanf.c | ||
strcat.c | ||
strchr.c | ||
strcmp.c | ||
strcpy.c | ||
strcspn.c | ||
strncmp.c | ||
strrchr.c | ||
strstr.c |