2009/8/25 Gábor Stefanik <netrolller.3d@xxxxxxxxx>: > The Qdiv roundup routine is essentially a fixed-point > division algorithm, using only integer math. > However, the version in the specs had a major error > that has been recently fixed (a missing quotient++). > > Replace Qdiv roundup with a rewritten, simplified version. Hi! > @@ -1042,20 +1042,14 @@ static u32 lpphy_qdiv_roundup(u32 dividend, u32 divisor, u8 precision) > quotient = dividend / divisor; > remainder = dividend % divisor; > > - rbit = divisor & 0x1; > - roundup = (divisor >> 1) + rbit; > - > while (precision != 0) { > - tmp = remainder - roundup; > quotient <<= 1; > - if (remainder >= roundup) > - remainder = (tmp << 1) + rbit; > - else > - remainder <<= 1; > + quotient |= (remainder << 1) / divisor; > + remainder = (remainder << 1) % divisor; > precision--; > } Unless precision is 0, this just added a bunch of divides into the inner loop, which might be a big surprise to anyone expecting this to be fast... -- Bob Copeland %% www.bobcopeland.com -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html