Re: Fastcode CompareMem B&V 1.0



HI Dennis,

You can remove CompareMem_Sha_IA32_1_a.
CompareMem_Sha_IA32_3_a is a little faster.

--
regards
Aleksandr

function CompareMem_Sha_IA32_3_a(P1, P2: pointer; Length: integer): boolean;
asm
sub edx, eax
add ecx, -8
push ebx
jl @Byte
mov ebx, [eax+edx]
cmp ebx, [eax]
jne @Ret0
add ecx, eax
add eax, 4
and eax, -4
sub ecx, eax
jl @Byte
@DwordLoop:
mov ebx, [eax+edx]
cmp ebx, [eax]
jne @Ret0
mov ebx, [eax+edx+4]
cmp ebx, [eax+4]
jne @Ret0
add eax, 8
add ecx, -8
jge @DwordLoop
@Byte:
add ecx, 8
jle @Ret1
@ByteLoop:
movzx ebx, [eax+edx]
cmp bl, [eax]
jne @Ret0
add eax, 1
add ecx, -1
jg @ByteLoop
@Ret1:
mov eax, 1
pop ebx
ret
@Ret0:
xor eax, eax
pop ebx
end;



.



Relevant Pages