by phoboslab · 16y ago · 0 comments
Also, wouldn't it be faster to check all four characters at once with a 32bit compare? And what about branch prediction of the CPU?
Within the linux kernel the macros likely and unlikely are defined so that you can have code of the style
if(likely(x > 10)) {
/* These instructions, which probably will be executed,
* will be cached
*/
}
if(unlikely(ptr == NULL)) {
/* These instructions, which probably won't need to be
* executed, will not be cached
*/
}