]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
include/linux/ctype.h: make isdigit() table lookupless
authorAlexey Dobriyan <adobriyan@gmail.com>
Tue, 11 Oct 2016 20:51:30 +0000 (13:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 11 Oct 2016 22:06:30 +0000 (15:06 -0700)
commit1204c77f9b6ab8ba8cc6cfe00342f5e64a740cdf
tree7c48ad22c756dc7b6215ac5aca362bc192efd35a
parentbf90e56e467ed5766722972d483e6711889ed1b0
include/linux/ctype.h: make isdigit() table lookupless

Make isdigit into a simple range checking inline function:

return '0' <= c && c <= '9';

This code is 1 branch, not 2 because any reasonable compiler can
optimize this code into SUB+CMP, so the code

while (isdigit((c = *s++)))
...

remains 1 branch per iteration HOWEVER it suddenly doesn't do table
lookup priming cacheline nobody cares about.

Link: http://lkml.kernel.org/r/20160826190047.GA12536@p183.telecom.by
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/ctype.h