Quote Originally Posted by aratti View Post
Hi Darrel, I tested the sorting snippet you have posted, using a rather interesting swapping technique.
The code worked, but now and than, it was yielding very fanny results.
From a closer code analysis, I came to the conclusion that :
If CounterA > 0 then CounterA=CounterA-2
should be corrected with:
If CounterA > 1 then CounterA=CounterA-2
After the correction, I didn't see any fanny result for the rest of my testing period.
The explanation I have given is the following:

If CounterA = 1 then CounterA - 2 = 255 and this screw up everything.

Can you confirm?

Well, I wouldn't think it's a problem.
Right after the IF block that statement is in, Melanie put a ...


So if CounterA = 1, subtracting 2 makes it 255, then adding 1 makes it 0 again.

Had you made any other changes?