function ESBSame (const Obj1, Obj2; const Size: LongWord): Boolean;
asm
push esi // Preserve ESI
push edi // Preserve EDI
mov esi, eax // Move DWord from Obj1 into ESI
mov edi, edx // Move DWord from Obj2 into EDI
mov eax, ecx // Store Initial Size in EAX
sar ecx, 2 // Count DIV 4 gives numer of Dwords
js @@False
repe cmpsd // compare as dwords
jnz @@False // if Not Zero, then False
mov ecx, eax // Compare mod 3 bytes
and ecx, 03
repe cmpsb // compare as bytes
jnz @@False // if Not Zero, then False
@@True:
mov al, True // else True
jmp @@Done
@@False:
mov al, False
@@Done:
pop edi // Restore EDI
pop esi // Restore ESI
End; |