The MASM Forum

General => The Campus => Topic started by: NoCforMe on July 12, 2022, 01:23:39 PM

Title: Comparing two QWORDs
Post by: NoCforMe on July 12, 2022, 01:23:39 PM
Another rookie question (from a non-rookie, no less):
Is this the correct way to do an unsigned comparison between two QWORD items in regular MASM (no SSE, MMX or other fancy stuff)?


Item1 LABEL QWORD
  Item1Hi DD ?
  Item1Lo DD ?

Item2 LABEL QWORD
  Item2Hi DD ?
  Item2Lo DD ?

;***** Compare the two (unsigned):  *****

; Compare the high DWORDs first:
MOV EDX, Item1Hi
CMP EDX, Item2Hi
JA bigger
JB smaller

; They're equal, so compare the low DWORDs:
MOV EAX, Item1Lo
CMP EAX, Item2Lo
JA bigger
JB smaller

;***** They're equal here ...

bigger:

smaller:
Title: Re: Comparing two QWORDs
Post by: NoCforMe on July 12, 2022, 02:27:27 PM
OK, figured it out. The answer is yes.