Thank you all for testing it
Jochen,
but it doesn't make your algos faster

No, the result would be «00009 µs for Mymin»
More ... or ... less !
MichaelW,
Take a look at your reply #37
I converted qword’s code to a procedure and applied Dave’s modifications
(except the last) to my code, and did a cycle count comparison.
You NEVER compare the first value
because you did this:
sub ecx, 1
jnz L0 ; when ECX=0 dont COMPARE !
We MUST use jns and NOT jnz
sub ecx, 1
jns L0 ; when ECX>0 or ECX= 0 COMPARE !
KeepingRealBusy
Hi Dave
Take a look at your reply #31
Always seed max and min with the first value, predecrement the index,
then loop with jnz (since the first element was the basis of min/max) instead of jns
No. We need to use
jns instead of
jnz Your error is here : "the first element was the basis of min/max"
Here, the first element (is the last) is at ECX=length_of_array-1
and not at ECX=0.
In any way, if we test from first (ECX=0) to last [ECX=length_of_array-1]
we compare ECX with length_of_array
add ecx, 1
cmp ecx, length_of_array
jne L?