Author Topic: Comparing two QWORDs  (Read 499 times)

NoCforMe

  • Member
  • *****
  • Posts: 1124
Comparing two QWORDs
« 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)?

Code: [Select]
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:

NoCforMe

  • Member
  • *****
  • Posts: 1124
Re: Comparing two QWORDs
« Reply #1 on: July 12, 2022, 02:27:27 PM »
OK, figured it out. The answer is yes.