]> git.baikalelectronics.ru Git - kernel.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)
commit8ff877179947e8d05aab5445acb99129fce3f935
tree7c48ad22c756dc7b6215ac5aca362bc192efd35a
parent0659fb46499c3af67f46dc0b7ace79ebd1ba0c63
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