Hi. What I want to do is to find out if there are any zero bytes in a DWORD. For example, FF00FFAAh has a zero byte, but CCAABBFFh does not. I'm looking for a very fast way, so that excludes checking every part of the DWORD. Thanks =)
Posted on 2001-05-01 04:54:00 by GogetaSSJ4
i'm not really sure, but if you would XOR the dword with 00FFFFFFh the dword becomes kind of inverted (?)........no, forget it. perhaps it's a hint to do something with XOR,AND,OR
Posted on 2001-05-01 05:25:00 by [SaFc0n]
this code appears in my mind reading your post...

xor  ebx, ebx
xor  ecx, ecx
mov  eax, testvalue
test al, al
sete cl
add  ebx ,ecx

test ah, ah
sete cl
add  ebx ,ecx

shr  eax, 16
test al, al
sete cl
add  ebx ,ecx

test ah, ah
sete cl
add  ebx ,ecx
ebx gives the number of zero bytes not short, but label free :D even not tested, just written in my IExplorer.
Posted on 2001-05-01 08:46:00 by beaster
Agner Fog does this operation in his StrLen algorithm, you can find it in the MASM32 library directory m32lib. Regards, hutch@pbq.com.au
Posted on 2001-05-01 09:33:00 by hutch--
Thank you very much. =)
Posted on 2001-05-02 01:06:00 by GogetaSSJ4
How about this: push eax ;or whatever dword mov edi,esp mov ecx,4 mov al,0 repne scasb pop eax and now ZF is set iff there was a zero byte. That assumes ES=SS, which seems to be true in Windows, normally. If not, use memory for the dword. There are various other occasions for making small temporary strings on the stack.
Posted on 2001-05-22 08:00:00 by Larry Hammick