Hii JJ. Tks :)
I believe the porting to masm, is something like this:
UniStrLenJJ proc Input :DWORD
; <--- uses ebp, rather then esp. Here should have a push ebp | mov ebp, esp at start. Forgot how to include that. Maybe using invoke token in masm, right ?
push ecx
push edx
mov eax, Input
mov ecx, eax
and eax, -16
and ecx, 16-1
or edx, -1
shl edx, cl
xorps xmm0, xmm0
pcmpeqw xmm0, [eax] ; <---- or it is xmmword ptr [eax]. Don´t remember if there is a xmmword instruction in masm. It´s the same as in Algo1, but using pcmpeqw rather then pcmpeqb
add eax, 16
pmovmskb ecx, xmm0
xorps xmm0, xmm0
and ecx, edx
jnz short Out1
InnerLoop:
movups xmm1, [eax]; <---- or it is xmmword ptr [eax]. Don´t remember if there is a xmmword instruction in masm
pcmpeqw xmm1, xmm0
pmovmskb ecx, xmm1
add eax, 16
test ecx, ecx
jz short InnerLoop
Out1:
bsf ecx, ecx
lea eax, [ecx+eax-16]
sub eax, Input
shr eax, 1
pop edx
pop ecx
retn 4 <----- or a simple ret..Don´t remember the syntax. before the ret should have a mov esp, ebp | pop ebp instructions
UniStrLenJJ endp