On 2016/6/30 2:31, Michal Nazarewicz wrote: > On Thu, Jun 30 2016, zengzhaoxiu wrote: ....... >> So this replaces table lookup in tolower with an explicit table lookup >> here while also removing some branches. >> >> Is that an improvement? Hard to say. _ctype table is used by all the >> other isfoo macros so there’s a chance it’s already in cache the first >> time hex_to_bin is called. Having to read the data into cache may >> overwhelm advantages of lack of branches.
In the 2nd patch, I use the inlined hex_to_bin to replace the local conversion in _parse_integer which used by all kstrto... functions, so the heat of h2b_lut may not be less than _ctype table. Additionally,in the vast majority of cases,only these bytes (0x00, 0x30~0x39, 0x41~0x46, 0x61~0x66) will be used.