Hi all!
Some extension of Mabdelouahab's macros that allow floating point numbers comparisons for conditional flow easily (usually it's not so simple because early expansion).
mov wParam, 1
mov pMsg, WM_PAINT
mov lParam, 3
fSlv8 alor1 = 1.5
fSlv8 alor2 = 2.2
@if wParam eq 1
@if lParam ne 3 || pMsg eq WM_COMMAND
@if wParam gt 1 || wParam lt 4
print " ----------------------------------------",13,10
print " Ain't Mabdelouahab's runtime comparisons great",13,10
print " ----------------------------------------",13,10
@endif
@elseif alor1 fGT 1.0 && alor2 fNE 2.0
print " ----------------------------------------",13,10
print " Is working? Yes",13,10
print " ----------------------------------------",13,10
@else
print " ----------------------------------------",13,10
print " Nothing ",13,10
print " ----------------------------------------",13,10
@endif
@endif
I was developing almost exactly the same :biggrin:, but discovery of Mab's macros save me to make most difficult part (comparison expansion) :thumbsup:
Last modifications 2021 in files:
Hi all!!
Some extensions for unsigned comparisons and check floting point: run_time_comparisons MACRO
% echo **************************************
% echo variable run time comparison operators
% echo **************************************
% echo -------------
% echo equality test
% echo -------------
% echo eq equal
% echo ne not equal
% echo
% echo -----------------
% echo signed comparison
% echo -----------------
% echo gt signed greater than
% echo lt signed less than
% echo ge signed greater than or equal
% echo le signed less than or equal
% echo
% echo -------------------
% echo unsigned comparison
% echo -------------------
% echo ua unsigned above
% echo ub unsigned below
% echo ae unsigned above or equal
% echo be unsigned below or equal
% echo
% echo -------------------------
% echo floating point comparison
% echo -------------------------
% echo fEQ equal
% echo fNE not equal
% echo
% echo fGT greater than
% echo fLT less than
% echo fGE greater than or equal
% echo fLE signed less than or equal
% echo
% echo --------------------
% echo floating point check
% echo --------------------
% echo r4Is check real4 is NotNaN/Valid
% echo r8Is check real8 is NotNaN/Valid
% echo **************************************
ENDM
; ************************************************
Some problem with registers. Work perfectly eax lt ebx (opcodes are same that MASM HLL eax < ebx), but fails eax ub ebx.
Regards, HSE.
Later: Because macros are not sofisticated the wrong operation is founded: eaxubebx instead eaxubebx :biggrin: very funny
Hi all !!
Because letters to identify integer comparisons are so common, original macros can have a lot of problems.
I replaced spaces remotion with filling, in this case "___"(three underscores). Then no more conflicts.
Right now requiere single spaces, but everybody can improve that :biggrin:
Files in first post.
Regards, HSE.
Thanks HSE! :thumbsup:
Biterider
:biggrin: Here a test in 64 bits using ML64.
Line 28 must be commented because qWord only tested SmplMath for 64 bits in JWASM, that was before invoke macro for ML64:ELSEIF @WordSize EQ 8
IFNDEF __JWASM__
; .err <The SmplMath System requires JWASM for x86-64 support>
fslv_glb_error = 1
ENDIF
includelib \masm32\macros\SmplMath\lib\x64\SmplMath.lib
ELSE