diff options
author | Eric Anholt <[email protected]> | 2014-06-27 15:09:32 +0100 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-07-30 22:30:19 -0700 |
commit | bfb0da9fa765242f52dc66a5acb14037ef17be94 (patch) | |
tree | 782ec68ae0d89a4fae3eec56ce140b8a48370ea4 /src/gallium/auxiliary/util | |
parent | bf3a26266d3f5da18a215c8c11ce75d01582e989 (diff) |
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 <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index d956fa1c975..2823e0570fc 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]. |