[Mesa-dev] [PATCH 1/5] gallium/util: add util_last_bit64
Ilia Mirkin
imirkin at alum.mit.edu
Sun May 24 08:36:41 PDT 2015
On Sun, May 24, 2015 at 5:47 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This will be needed by radeonsi.
Then it should probably be included in a patch series that touches radeonsi...
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
but I'd prefer it if you could push this along with radeonsi changes,
not just the core gallium ones.
> ---
>
> These 5 patches are picked from my tessellation branch.
>
> src/gallium/auxiliary/util/u_math.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
> index 58070a9..3b4040f 100644
> --- a/src/gallium/auxiliary/util/u_math.h
> +++ b/src/gallium/auxiliary/util/u_math.h
> @@ -425,6 +425,25 @@ util_last_bit(unsigned u)
> }
>
> /**
> + * Find last bit set in a word. The least significant bit is 1.
> + * Return 0 if no bits are set.
> + */
> +static INLINE unsigned
> +util_last_bit64(uint64_t u)
> +{
> +#if defined(HAVE___BUILTIN_CLZLL)
> + return u == 0 ? 0 : 64 - __builtin_clzll(u);
> +#else
> + unsigned r = 0;
> + while (u) {
> + r++;
> + u >>= 1;
> + }
> + return r;
> +#endif
> +}
> +
> +/**
> * Find last bit in a word that does not match the sign bit. The least
> * significant bit is 1.
> * Return 0 if no bits are set.
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list