On Thu, Apr 20, 2006 at 04:52:14PM +0100, Dave Korn wrote: > Yet it would seem to me at first glance that, since dividing unsigned by an > exact power-of-2 can be optimised to a right shift, and since we can deduce > that (1 << bpp) is always going to be a power-of-2
Isn't that true only if bpp is small enough? OTOH, on big bpp we're probably straight into undefined territory so it may not matter. But still, it changes an expected divide-by-zero on some cpus and divide-by-one on others by a zero return, which may be surprising. I suspect the divide-by-shift is hidden behind a bazillion macros, right? Only that would explain that a human could write such code :-) OG.