jj, please a little more effectiveness for the macros...
useA=1
;...
CodeSize MACRO algo, overhead:=<15> ; default overhead is mov ecx, 99+mov eax, ecx+loop
pushad
mov eax, offset &algo&_endp ; OPT_Errline 0
sub eax, offset &algo&_s
sub eax, overhead
if @CatStr(<!'>,%@SubStr(<algo>,5),<!'>) GE 'A' AND @CatStr(<!'>,%@SubStr(<algo>,5),<!'>) LE 'Z'
% print str$(eax), 9, @CatStr(<!"bytes for &Name>,%@SubStr(<algo>,5),<!">), 13, 10
else
% print str$(eax), 9, "bytes for other", 13, 10
endif
popad
ENDM
AlgoName$ MACRO algo
if @CatStr(<!'>,%@SubStr(<algo>,5),<!'>) GE 'A' AND @CatStr(<!'>,%@SubStr(<algo>,5),<!'>) LE 'Z'
EXITM @CatStr(<!"bytes for &Name>,%@SubStr(<algo>,5),<!">)
else
EXITM <"other">
endif
ENDM
;...
start:
push 1
call ShowCpu ; print brand string and SSE level
invoke SetProcessAffinityMask, -1, 1 ; restrict to one core
Calibrate
??cntr = 1
REPEAT ShowLoops+2
IF ??cntr LT ShowLoops+1
SpinUp
ENDIF
FORC char,<ABCDEFGHIJKLMNOPQRSTUVWXYZ>
IFDEF use&char&
IF use&char&
IF ??cntr LT ShowLoops+1
invoke Sleep, SleepMs
counter_begin TimerLoops, HIGH_PRIORITY_CLASS
call Test&char&
counter_end
ShowCycles Test&char&
ELSEIF (??cntr EQ ShowLoops+1) AND ShowSize NE 0
CodeSize Test&char&
ELSEIF (??cntr EQ ShowLoops+2) AND ShowResult NE 0
CodeResult Test&char&
ENDIF
ENDIF
ENDIF
ENDM
IF (??cntr LT ShowLoops+1) OR ((??cntr EQ ShowLoops+1) AND ShowSize NE 0) OR ((??cntr EQ ShowLoops+2) AND ShowResult NE 0)
print chr$(13, 10)
ENDIF
??cntr = ??cntr + 1
ENDM
inkey chr$(13, 10, "--- ok ---", 13)
exit
:icon_cool: