Furthermore, the check for a zero block can be done pretty cheaply (I
thought about doing this years ago for v7 Unix).  First see if the
first word of the buffer is zero; if so, see if the last word is zero;
if so, run through the buffer a word at a time, stopping at a non-zero
word or end of buffer.

In the common (real-life) case, the test of the first word suffices.
The word-at-a-time scan can be made to run fairly fast, especially if
you have the option of first putting a non-zero word just after the
buffer, so that no explicit bounds test is necessary in the loop.

Reply via email to