Is there a fast way to count the amount of successive null bytes starting from a certain (char*) pointer in C? I’m currently using a tight loop, which works well and is fast enough, but libc/gcc’s string functions tend to be even faster.
I’m looking for something similar to strspn, buf strspn (of course) stops at the first null byte and is therefore useless for this task. I guess you could also say I’m looking for the inverse of strlen, which returns number of bytes that are not null.
If your pointer is word-aligned, you could check it for zeroness a word at a time.