How to compare the difference between A and B if they are in same structure. For example the structure is as follows


rc struct
x dd ?
y dd ?
x dd 100 dup(?)
rc ends

Note the method should be fast. Thanks
Posted on 2002-05-10 11:17:07 by yoursguideline
mov esi, OFFSET A
mov edi, OFFSET B
mov ecx, SIZEOF rc -4
@@:
mov eax,
add esi, 4
sub eax,
jne @F
add edi, 4
sub ecx, 4
jns @B
xor eax, eax
@@:
; eax=0 if same

; okay, it's not too fast
; ...and it doesn't work for structures of odd size ;)

How many structures do you want to compare?
What size are the structures?
Are they in an array? ...contigious?
What processors do you want to optimize for?

All these things need to be considered for more speed.
Posted on 2002-05-10 11:35:37 by bitRAKE
i want to compare quite a lot and the structure actually is in RECT. I ask the question before using different struct since i want to know the general fast algorithm for comparison. :tongue:
Posted on 2002-05-10 18:07:03 by yoursguideline