[Mesa-dev] [PATCH 1/3] gallium: Add a uif() helper function to complement fui()

Michel Dänzer michel at daenzer.net
Thu Jul 17 19:14:26 PDT 2014


On 18.07.2014 08:56, Eric Anholt wrote:
> I found myself often wanting this when I'm printing out a uint32_t mapping
> of some GPU data, and I want to put in an interpretation of that value as
> a float.
> ---
>  src/gallium/auxiliary/util/u_math.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
> index b9ed197..68ca3f2 100644
> --- a/src/gallium/auxiliary/util/u_math.h
> +++ b/src/gallium/auxiliary/util/u_math.h
> @@ -616,6 +616,14 @@ fui( float f )
>     return fi.ui;
>  }
>  
> +static INLINE float
> +uif(uint32_t ui)
> +{
> +        union fi fi;
> +        fi.ui = ui;
> +        return fi.f;
> +}
> +
>  
>  /**
>   * Convert ubyte to float in [0, 1].
> 

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

The GBM changes look good to me as well.


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer


More information about the mesa-dev mailing list