
; Function CompareCur(ucThis As Currency, _
;                     ucThat As Currency) As Long

 .486          ; 32-bit instruction set
 .model flat   ; Protected memory, 4GB limit
 .code         ; Start of code

; CompareCur can be used in conjunction with
; ULngsToCur and CurToULngs.

; This comparison will produce valid results if
; passed ULngsToCur unsigned currency values.

; Note - Unsigned dword and qword values assigned
; by ULngsToCur will display incorrectly in VB.

; Assigning unsigned longs to Currency within VB
; may corrupt the value by sign extending it - in
; this case they will not compare correctly.

CompareCur proc near

  mov ecx,[esp+8]
  mov eax,[ecx+4]
  mov ecx,[esp+12]
  mov edx,[esp+16]
  cmp eax,[ecx+4]
  mov eax, 0
  jb _lesser     ; First file time is less than second file time
  ja _greater    ; First file time is greater than second file time
  mov ecx,[esp+8]
  mov eax,[ecx]
  mov ecx,[esp+12]
  cmp eax,[ecx]
  mov eax, 0
  jb _lesser     ; First file time is less than second file time
  ja _greater    ; First file time is greater than second file time

  mov [edx], eax ; First file time is equal to second file time
  ret 16

 _lesser:
  mov [edx],dword ptr -1
  ret 16

 _greater:
  mov [edx],dword ptr 1
  ret 16

CompareCur endp
end CompareCur
