maybe this question is a bit strange, but I wonder how to
detect whether or not a block of memory (lets say 2k) is cleared
(filled with zero).

Ofcource I can perform an OR with all DWORDs and check the result for
non-zero or do a CMP with all of them but, is there a really cool way
to perform this without looping 512 times?

Maybe I'm to blind to see.

BTW, don't say do a ZeroMemory() and you can be sure or use MMX/SSE
for 256 loops or less ;)

Bye Miracle
Posted on 2003-03-31 11:30:47 by miracle
cmp dword with 0 ....
Posted on 2003-03-31 12:27:07 by SFP

cmp DWORD PTR[edi],0
jz out
cmp DWORD PTR[edi+4],0
jz out
cmp DWORD PTR[edi+8],0
jz out
cmp DWORD PTR[edi+12],0
jz out
add edi,16
jmp @B

just loop
Posted on 2003-03-31 12:45:32 by roticv
push	edi

mov edi, OFFSET block
mov ecx, 2048 shr 2 ; 2048 bytes (2KB)
xor eax, eax
repe scasd
pop edi
je empty
jne not_empty
Posted on 2003-03-31 23:37:59 by comrade
If by "really cool" you mean fast then read this thread:
Posted on 2003-04-01 00:17:16 by bitRAKE