In said:
is there a fast way to check for large regions of binary zeroes in
memory? the solution could be either in C or in assemble language? i
am interested in any RISC platforms.
The fastest solution can be obtained in assembly, but this is not
something we can discuss here, and it's higly processor specific, anyway.
At C level, it's easier if the region is aligned for long access, but you
can do the alignment yourself, by converting the pointer to an unsigned
long, aligning the integer value and then converting it back to a
pointer. Do the testing accessing as much as possible of the memory
block as an array of unsigned long and test the first and the last
few bytes as unsigned char, if necessary. As unsigned long has the same
size as the processor word on any decent implementation for RISC
platforms, this is the best you can do, in C code. If the chances that
the memory block is zeroed are high, you may try OR-ing all the words
together in a loop and only testing the final result.
Ignore any objections other people might raise about padding bits:
they have yet to be seen on any RISC platform. And the unsigned integer
types are immune from any dual representation of the zero value (in the
absence of padding bits).
Dan