Mesa (master): util: Remove the half typedef from p_compiler.h.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Apr 7 21:19:44 UTC 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Apr  7 21:00:05 2010 +0100

util: Remove the half typedef from p_compiler.h.

Unnecessary, and doesn't even guarantee size.

---

 progs/gallium/unit/u_half_test.c      |    4 ++--
 src/gallium/auxiliary/util/u_half.h   |    8 ++++----
 src/gallium/include/pipe/p_compiler.h |    2 --
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/progs/gallium/unit/u_half_test.c b/progs/gallium/unit/u_half_test.c
index 9e3392e..00bda7f 100644
--- a/progs/gallium/unit/u_half_test.c
+++ b/progs/gallium/unit/u_half_test.c
@@ -12,9 +12,9 @@ main(int argc, char **argv)
    unsigned roundtrip_fails = 0;
    for(i = 0; i < 1 << 16; ++i)
    {
-      half h = (half) i;
+      uint16_t h = (uint16_t) i;
       union fi f;
-      half rh;
+      uint16_t rh;
       f.ui = util_half_to_floatui(h);
       rh = util_floatui_to_half(f.ui);
       if(h != rh)
diff --git a/src/gallium/auxiliary/util/u_half.h b/src/gallium/auxiliary/util/u_half.h
index bc41c65..5a116da 100644
--- a/src/gallium/auxiliary/util/u_half.h
+++ b/src/gallium/auxiliary/util/u_half.h
@@ -26,28 +26,28 @@ extern const uint8_t util_float_to_half_shift_table[512];
  */
 
 static INLINE uint32_t
-util_half_to_floatui(half h)
+util_half_to_floatui(uint16_t h)
 {
    unsigned exp = h >> 10;
    return util_half_to_float_mantissa_table[util_half_to_float_offset_table[exp] + (h & 0x3ff)] + util_half_to_float_exponent_table[exp];
 }
 
 static INLINE float
-util_half_to_float(half h)
+util_half_to_float(uint16_t h)
 {
    union fi r;
    r.ui = util_half_to_floatui(h);
    return r.f;
 }
 
-static INLINE half
+static INLINE uint16_t
 util_floatui_to_half(uint32_t v)
 {
    unsigned signexp = v >> 23;
    return util_float_to_half_base_table[signexp] + ((v & 0x007fffff) >> util_float_to_half_shift_table[signexp]);
 }
 
-static INLINE half
+static INLINE uint16_t
 util_float_to_half(float f)
 {
    union fi i;
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index d645fd0..09d6b6c 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -74,8 +74,6 @@ typedef unsigned char boolean;
 #define FALSE false
 #endif
 
-typedef unsigned short half;
-
 /* Function inlining */
 #ifndef INLINE
 #  ifdef __cplusplus




More information about the mesa-commit mailing list