Mesa (master): gallivm: silence casting warning

Brian Paul brianp at kemper.freedesktop.org
Thu May 13 20:17:13 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu May 13 13:25:29 2010 -0600

gallivm: silence casting warning

---

 src/gallium/auxiliary/gallivm/lp_bld_format_aos.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
index 5a52d81..eb49204 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
@@ -310,6 +310,21 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder,
 }
 
 
+typedef void (*fetch_func)(float *, const uint8_t *, unsigned, unsigned);
+
+/** cast wrapper */
+static void *
+fetch_func_ptr_to_voidptr(fetch_func f)
+{
+   union {
+      void *v;
+      fetch_func f;
+   } u;
+   u.f = f;
+   return u.v;
+}
+
+
 /**
  * Fetch a pixel into a 4 float AoS.
  *
@@ -390,7 +405,8 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
 
          assert(LLVMIsDeclaration(function));
 
-         LLVMAddGlobalMapping(lp_build_engine, function, format_desc->fetch_rgba_float);
+         LLVMAddGlobalMapping(lp_build_engine, function,
+                    fetch_func_ptr_to_voidptr(format_desc->fetch_rgba_float));
       }
 
       tmp = lp_build_alloca(builder, LLVMVectorType(LLVMFloatType(), 4), "");




More information about the mesa-commit mailing list