summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-06-27 15:09:32 +0100
committerEric Anholt <[email protected]>2014-07-30 22:30:19 -0700
commitbfb0da9fa765242f52dc66a5acb14037ef17be94 (patch)
tree782ec68ae0d89a4fae3eec56ce140b8a48370ea4 /src/gallium/auxiliary
parentbf3a26266d3f5da18a215c8c11ce75d01582e989 (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')
-rw-r--r--src/gallium/auxiliary/util/u_math.h8
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].