On Fri, 18 Mar 2011 08:22:16 -0700, Keith Packard wrote: > On Fri, 18 Mar 2011 08:02:09 +0000, Chris Wilson wrote: > > > A broken implementation of is_pot() prevented the detection of when a > > singular pipe was enabled. > > > - return mask && (mask & -mask) == 0; > > + return mask && (mask & -mask) == mask; > > I think the form > > mask && (mask & (mask - 1)) == 0 > > is easier to reason about. > > But, your fix is also correct as it finds the lowest bit set in 'mask' > and checks to see if that is the same as mask. At the risk of bikeshed, is_power_of_2() in log2.h is prettier. (note: treats 0 as not power of two).