I'm looking for the fastest way to test if a block of memory is all
zeros or not. This needs to be as fast as possible since it is being
tested many times a second.
The memory block can be any length. Assuming Buffer is a pointer to a
block of memory, and BufferSize is the length of the block, I'm
currently doing it like this.
type
TBufferArray = array[0..0] of Byte;
PBufferArray = ^TBufferArray;
....
var
BufArray: BufferArray;
i: Integer;
begin
BufArray := Buffer;
Result := False;
for i := 0 to BufferSize-1 do
if Buffer[i] <> 0 then Exit;
Result := True;
This is reasonably quick but I'm wondering if there is a faster way that
does not need to increment an integer many times.
Thanks,
Ross.
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi