Update v1.04
Code: Select all
;-TOP
; Kommentar :
; Author : mk-soft
; Second Author :
; Datei : UnsignedCompare.pb
; Version : 1.05
; Erstellt : 10.03.2009
; Geändert : 10.03.2017
;
; Compilermode :
;
; ***************************************************************************************
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
; X86 ************************************************************************************
Procedure Above(a.i, b.i)
; If a > b
!MOV eax,dword [p.v_a]
!CMP eax,dword [p.v_b]
!JBE l_not_above
; ProcedureReturn #True
!MOV eax,1
ProcedureReturn
!l_not_above:
; ProcedureReturn #False
!XOr eax,eax
ProcedureReturn
EndProcedure
; ***************************************************************************************
Procedure AboveEqual(a.i , b.i)
; If a >= b
!MOV eax,dword [p.v_a]
!CMP eax,dword [p.v_b]
!JB l_not_above_equal
; ProcedureReturn #True
!MOV eax,1
ProcedureReturn
!l_not_above_equal:
; ProcedureReturn #False
!XOR eax,eax
ProcedureReturn
DisableASM
EndProcedure
; ***************************************************************************************
Procedure Below(a.i, b.i)
; If a < b
!MOV eax,dword [p.v_a]
!CMP eax,dword [p.v_b]
!JAE l_not_below
; ProcedureReturn #True
!MOV eax,1
ProcedureReturn
!l_not_below:
; ProcedureReturn #False
!XOr eax,eax
ProcedureReturn
EndProcedure
; ***************************************************************************************
Procedure BelowEqual(a.i, b.i)
; If a <= b
!MOV eax,dword [p.v_a]
!CMP eax,dword [p.v_b]
!JA l_not_below_equal
; ProcedureReturn #True
!MOV eax,1
ProcedureReturn
!l_not_below_equal:
; ProcedureReturn #False
!XOr eax,eax
ProcedureReturn
DisableASM
EndProcedure
CompilerElse
; X64 ************************************************************************************
Procedure Above(a.q, b.q)
; If a >= b
!MOV r15,qword [p.v_a]
!CMP r15,qword [p.v_b]
!JBE l_not_above
; ProcedureReturn #True
!MOV rax,1
ProcedureReturn
!l_not_above:
; ProcedureReturn #False
!XOr rax,rax
ProcedureReturn
EndProcedure
; ***************************************************************************************
Procedure AboveEqual(a.i , b.i)
; If a >= b
!MOV r15,qword [p.v_a]
!CMP r15,qword [p.v_b]
!JB l_not_above_equal
; ProcedureReturn #True
!MOV rax,1
ProcedureReturn
!l_not_above_equal:
; ProcedureReturn #False
!XOr rax,rax
ProcedureReturn
EndProcedure
; ***************************************************************************************
Procedure Below(a.i, b.i)
; If a < b
!MOV r15,qword [p.v_a]
!CMP r15,qword [p.v_b]
!JAE l_not_below
; ProcedureReturn #True
!MOV rax,1
ProcedureReturn
!l_not_below:
; ProcedureReturn #False
!XOr rax,rax
ProcedureReturn
EndProcedure
; ***************************************************************************************
Procedure BelowEqual(a.i, b.i)
; If a <= b
!MOV r15,qword [p.v_a]
!CMP r15,qword [p.v_b]
!JA l_not_below_equal
; ProcedureReturn #True
!MOV rax,1
ProcedureReturn
!l_not_below_equal:
; ProcedureReturn #False
!XOr rax,rax
ProcedureReturn
EndProcedure
; ***************************************************************************************
CompilerEndIf
; test
c = Above(1,2)
Debug "Unsigned grösser"
Debug Above( -1, 1)
Debug Above( 1, 1)
Debug "Unsigned grösser gleich"
Debug AboveEqual( -1, 1)
Debug AboveEqual( 1, 1)
Debug "Unsigned kleiner"
Debug Below( 1, -1)
Debug Below( 1, 1)
Debug "Unsigned kleiner gleich"
Debug BelowEqual( 1, -1)
Debug BelowEqual( 1, 1)