On Tue, May 08, 2012 at 09:09:24AM +0200, Dmitry Tarnyagin wrote: > Yes, correct, you mentioned all the 3 problems with the minstrel. > "Buggy" is not the best word here, minstrel just behaves in this way, > and the behavior is specified. It can be changed (at least last two), > but carefully and with respect to other minstrel clients. OK, thanks. I (and others) had also noticed these issues a while ago; I guess we should take a look at fixing it in the core. > As I remember compiler changes divide to a shift only for > unsigned divisions, isn't it? Or do modern gcc-s changes it for signed > divs as well? It's easy enough to check. I can't speak for ARM, but on gcc 4.6.0 for x86, I get the following: signed x / 2 compiles to (%eax = dividend): mov %eax,%edx ; put x into edx shr $0x1f,%edx ; edx >>= 31, so sign of x is LSB of edx add %edx,%eax ; eax += 1 (round up) if eax is signed sar %eax ; arithmetic (sign-preserving) shift right eax This sequence corrects for, say, -3 / 2 == -1 vs -3 >> 1 == -2. unsigned x / 2 compiles to: shr %eax ; same as x >> 1 Gcc has some neat tricks -- even something like "x * 22/7" gets turned into a pair of multiplies. > Well, it's datapath. This code is executed for every SDU in data traffic, > with frequency ~3kHz on target throughput. For me it's a good reason > to explicitly eliminate divisions :) Fair enough :) -- 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