gallium: Add a uif() helper function to complement fui()

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.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Eric Anholt 2014-06-27 15:09:32 +01:00
parent bf3a26266d
commit bfb0da9fa7

View file

@ -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].