Code: Select all
Procedure.s UStrQ(n.q)
Protected tmp.l
!mov ecx, 10
!xor edx, edx
!mov eax, [p.v_n + 4]
!div ecx
!mov [p.v_n + 4], eax
!mov eax, [p.v_n]
!div ecx
!mov [p.v_n], eax
!mov [p.v_tmp], edx
If n
ProcedureReturn Str(n) + Str(tmp)
Else
ProcedureReturn Str(tmp)
EndIf
EndProcedure
Debug UStrQ($ffffffffffffffff)
Unsigned compare
Code: Select all
Procedure.i UComL(n1.l, n2.l); returns -1 if n1 < n2, 0 if n2 = n2, 1 if n1 > n2
!mov eax, [p.v_n1]
!sub eax, [p.v_n2]
!jz ucoml_exit
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
!sbb rax, rax
CompilerElse
!sbb eax, eax
CompilerEndIf
!jnz ucoml_exit
!inc eax
!ucoml_exit:
ProcedureReturn
EndProcedure
Procedure.i UComQ(n1.q, n2.q); returns -1 if n1 < n2, 0 if n2 = n2, 1 if n1 > n2
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
!mov rax, [p.v_n1]
!sub rax, [p.v_n2]
!jz ucomq_exit
!sbb rax, rax
!jnz ucomq_exit
CompilerElse
!mov ecx, [p.v_n1]
!mov edx, [p.v_n1 + 4]
!sub ecx, [p.v_n2]
!sbb edx, [p.v_n2 + 4]
!sbb eax, eax
!jnz ucomq_exit
!or ecx, edx
!jz ucomq_exit
CompilerEndIf
!inc eax
!ucomq_exit:
ProcedureReturn
EndProcedure
If UComL($7fffffff, $ffffffff) < 0
Debug "$7fffffff < $ffffffff"
EndIf