On Sat, Apr 16, 2016 at 12:34 AM, Marek Olšák <mar...@gmail.com> wrote: > From: Marek Olšák <marek.ol...@amd.com> > > The second ffs returns 0, yielding count == -1. > --- > src/gallium/auxiliary/util/u_math.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/src/gallium/auxiliary/util/u_math.h > b/src/gallium/auxiliary/util/u_math.h > index b4ac0db..2880eea 100644 > --- a/src/gallium/auxiliary/util/u_math.h > +++ b/src/gallium/auxiliary/util/u_math.h > @@ -518,6 +518,12 @@ u_bit_scan64(uint64_t *mask) > static inline void > u_bit_scan_consecutive_range(unsigned *mask, int *start, int *count) > { > + if (*mask == 0xffffffff) { > + *start = 0; > + *count = 32; > + *mask = 0; > + return; > + } > *start = ffs(*mask) - 1; > *count = ffs(~(*mask >> *start)) - 1; > *mask &= ~(((1 << *count) - 1) << *start);
This signed shift needs to be fixed for *count == 31 too. Either way, Reviewed-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl> > -- > 2.5.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev