Forgive me if this info is useless.. but I recall there was a thread on strlen routines. I had no time to follow it and thus I don't know how far it went.. I just want to copy n'paste some code I had to write for another project, which detects (without branches) if in a DWORD there's at least one BYTE at 0. That could maybe help the strlen development.. that's up to you. Maybe you already found a much better solution, dunno.

Anyway, here's how I solved my problem to detect if there's at least a zero BYTE in a DWORD:



MOV EBX,EAX ; input DWORD is in EAX
SUB EAX,$01010101
NOT EBX
AND EAX,$80808080
AND EAX,EBX ; output in EAX will be 0 only if no BYTE was at 0


Should pair well even on old Pentiums. Sorry if it was useless, at least on the strlen issue.
You can extend the concept also to MMX or to other problems. Sorry no time this time to give a step by step detailed description of how it works.

Sorry for having said so many times "sorry". :tongue:
Posted on 2002-04-05 07:07:19 by Maverick
I gave a quick check at the last strlen routine and that technique was already implemented.. I should have checked before :P

Sorry (for the 5th time) :grin:
Posted on 2002-04-05 08:30:13 by Maverick
Also, look at MMX StringLen.
Posted on 2002-04-05 10:27:52 by bitRAKE
Sorry for being a newb, but what does the $ before the numbers do to the number?
Posted on 2002-04-24 14:20:21 by Ronin Magus
It's simply another way to specify hexadecimal. Not usually used for Intel assembly. Maverick is a little stuck on the 680x0 assembler syntax - I was myself for the longest time. :)
Posted on 2002-04-24 14:36:11 by bitRAKE