> You can use arithmetics to go branchless.
if (a[i] > 0) {
cnt++;
}
> Rewriting using arithmetic takes advantage of the fact that the expression a[i] > 0 has an arithmetic value 1 if true and 0 if false. So the whole expression can be rewritten as: cnt += a[i]
I guess you can attach a debugger for unit tests, but that's not very useful.
That is in fact incredibly useful