2 ms·
If n is not within k of the maximum unsigned integer: i = n+k; do { i -= k; ... } while (i >= k); If n is close enough to the maximum unsigned i
by tzs 11y ago
If n is not within k of the maximum unsigned integer:
i = n+k;
do {
i -= k;
...
} while (i >= k);
If n is close enough to the maximum unsigned integer for n+k to overflow:
i = n;
goto skip_sub;
do {
i -= k;
skip_sub:
...
} while (i >= k);