segin
public text v1 · immutable; bcmp.asm
; asm i386 bcmp() function
GLOBAL bcmp
bcmp:
push edi
push esi
mov edi,[12+esp]
mov esi,[16+esp]
xor eax,eax ; Clear return value
cld ; The compare direction must be set forward.
mov ecx,[20+esp] ; Word compare
shr ecx,2
repe
cmpsl
jne R1
mov ecx,[20+esp] ; Not enough data to do word compare; preform
and ecx,3 ; byte compare.
repe
cmpsb
je R2
R1: inc eax
R2: pop esi
pop edi
ret