Hi all !
What do you think :
which's the best way to compare 2 LARGE_INTEGERs ?
Without using MMX or FPU !
CObject,
Look at:
http://www.masmforum.com/simple/index.php?topic=2188.0
hth,
farrier
Assuming one is in eax:edx and the other in ebx:ecx (Just for simplicity, easily changed) try the following
cmp edx,ecx
jne @F
cmp eax,ebx
@@:
For unsigned 64bit number the state of the flags should now tell you which is bigger/smaller or if both equal.
I sovle my problem :8)
The following best fits for my needs
.386
.model flat,stdcall
LARGE struct
lo dd ?
hi dd ?
LARGE ends
;####################### CONST DATA ###########################
.const
;####################### INITDATA #############################
.data
largeValue1 LARGE<09C370555h,0000004Dh> ; 333 333 333 333
largeValue2 LARGE<0BD7A038Eh,00000033h> ; 222 222 222 222
;###################### UNINIT DATA ###########################
.data?
;######################### CODE ###############################
.code
start:
main proc
; largeValue1
mov eax,largeValue1.lo
mov ebx,largeValue1.hi
; largeValue2
mov ecx,largeValue2.lo
mov edx,largeValue2.hi
; largeValue1 - largeValue2
sub eax,ecx
sbb ebx,edx
; compare
shl ebx,1
jc nega
or eax,ebx ;cmp eax,0
jnz pos
PrintText "largeValue1 == largeValue2"
jmp quit
pos: PrintText "largeValue1 > largeValue2"
jmp quit
nega: PrintText "largeValue1 < largeValue2"
quit: mov eax,0
ret
main endp
;################### Functions definition #####################
end start
Nice method :).