Hi people, this is an small and easy one

PB doesn´t say anything against if you create a macro with the same name as a PBfunction, so it ´s possible to replace some functions with macros.
First Example: RGB (here RGB2, because else both lines had been replaced)
Code: Select all
Macro RGB2(mpr,mpg,mpb)
mpr+mpg<<8+mpb<<16
EndMacro
k=GetTickCount_()
For a=1 To 100000
For b=1 To 20000
farbe=RGB(255,0,255)
Next
Next
p=GetTickCount_()
For a=1 To 100000
For b=1 To 20000
farbe=RGB2(255,0,255)
Next
Next
l=GetTickCount_()
MessageRequester("Ergebnis:","Ohne Macro: "+Str(p-k)+Chr(13)+"Mit Macro: "+Str(l-p))
An other good thing is, that by using the Macro PB finds out, that the value is constant:
Procedure:
Macro:; farbe.l=RGB(255,0,255)
PUSH dword 255
PUSH dword 0
MOV eax,255
CALL PB_RGB
MOV dword [v_farbe],eax
; farbe.l=RGB2(255,0,255)
MOV dword [v_farbe],16711935