[Mesa-dev] [PATCH v2 11/12] gallium/util: Add u_bit_scan_consecutive_range64.

Marek Olšák maraeo at gmail.com
Sun Apr 17 23:18:41 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sun, Apr 17, 2016 at 1:43 AM, Bas Nieuwenhuizen
<bas at basnieuwenhuizen.nl> wrote:
> For use by radeonsi.
>
> v2: Make sure that it works for all 64 bits set.
>
> Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
>  src/gallium/auxiliary/util/u_math.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
> index b4ac0db..96c1618 100644
> --- a/src/gallium/auxiliary/util/u_math.h
> +++ b/src/gallium/auxiliary/util/u_math.h
> @@ -523,6 +523,20 @@ u_bit_scan_consecutive_range(unsigned *mask, int *start, int *count)
>     *mask &= ~(((1 << *count) - 1) << *start);
>  }
>
> +static inline void
> +u_bit_scan_consecutive_range64(uint64_t *mask, int *start, int *count)
> +{
> +   if (*mask == ~0llu) {
> +      *start = 0;
> +      *count = 64;
> +      *mask = 0;
> +      return;
> +   }
> +   *start = ffsll(*mask) - 1;
> +   *count = ffsll(~(*mask >> *start)) - 1;
> +   *mask &= ~(((1llu << *count) - 1) << *start);
> +}
> +
>  /**
>   * Return float bits.
>   */
> --
> 2.8.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list