popFront causing more memory to be used
bearophile
bearophileHUGS at lycos.com
Tue Jul 3 09:45:26 PDT 2012
ixid:
> int iter_next = iter + 1 > k? 0 : iter + 1;
This is becoming a "fixed size circular queue". But maybe a
modulus is faster than a branch here. (It's better when k is
always a power of two, you don't need a modulus. And even better
if your size is a multiple of the page size).
> nums[iter_next] = total % 10^^8;
In such cases I suggest to add (), to not force the person that
reads the code reader to remember the precedence of uncommon
operators.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list