[Libre-soc-bugs] [Bug 676] FORTRAN MAXLOC SVP64 example

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Thu Nov 16 22:25:45 GMT 2023


--- Comment #22 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Jacob Lifshay from comment #21)
> i noticed that changing the initial value of m to 0 instead of INT_MIN is
> incorrect, since the algorithm uses signed integers. m starting at 0 (or
> actually any int at all)

a correct implementation starts with:
if(n == 0)
    return -1;
m = a[0];
nm = 0;

if you assume the input isn't empty, you can remove the if(n == 0) return -1;

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list