Module: Mesa
Branch: master
Commit: bfb0da9fa765242f52dc66a5acb14037ef17be94
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfb0da9fa765242f52dc66a5acb14037ef17be94

Author: Eric Anholt <e...@anholt.net>
Date:   Fri Jun 27 15:09:32 2014 +0100

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.daen...@amd.com>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---

 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 d956fa1..2823e05 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].

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to