4 ms·
> The advantage of this construct is that you can use the flags set by the increment to test for loop termination, rather than needing an additional comparison.
by DblPlusUngood 10y ago
> The advantage of this construct is that you can use the flags set by the increment to test for loop termination, rather than needing an additional comparison.
I don't understand your optimization. ZF is also set for dec, so why not just use dec and not negate the size?
- nkurz 10y agoSticking with a positive value and using dec or sub works if you just have a loop counter or if it's acceptable to process the data in your buffer backwards, but switching to negative lets you go through the buffer in standard ascending order. Sometimes data dependencies require this, and sometimes ascending works better for prefetching.