Simplify queue_len() calculation.

If B is a power of two, then it turns out that A % B is the same as
A & (B-1) in two's complement, including for negative A. Since
(A + B) % B can be simplified to A % B, we can get rid of the length in
the numerator.