3 ms·
> count++, ptr++ Also, you should avoid this; it adds a extra addition per iteration for no real benefit. Try: p = ptr - 1 # also avoid branching[0] over
by a1369209993 6y ago
> count++, ptr++
Also, you should avoid this; it adds a extra addition per iteration for no real benefit. Try:
p = ptr - 1 # also avoid branching[0] over p++
body:
p++
if *p != 0 goto body
return p - ptr
0: I assume a single addition is cheaper than a unconditional branch, which is probable, but not nearly as big a difference as with conditional branches.