uint32_t *counter);
-/** cast wrapper to avoid compiler warnings */
-static INLINE lp_jit_frag_func
-cast_voidptr_to_lp_jit_frag_func(void *v)
-{
- union {
- void *v;
- lp_jit_frag_func f;
- } u;
- assert(sizeof(u.v) == sizeof(u.f));
- u.v = v;
- return u.f;
-}
-
-
-/** cast wrapper */
-static INLINE void *
-cast_lp_jit_frag_func_to_voidptr(lp_jit_frag_func f)
-{
- union {
- void *v;
- lp_jit_frag_func f;
- } u;
- assert(sizeof(u.v) == sizeof(u.f));
- u.f = f;
- return u.v;
-}
-
-
-
-
void
lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
+#include "util/u_pointer.h"
#include "util/u_format.h"
#include "util/u_dump.h"
#include "os/os_time.h"
{
void *f = LLVMGetPointerToGlobal(screen->engine, function);
- variant->jit_function[do_tri_test] = cast_voidptr_to_lp_jit_frag_func(f);
+ variant->jit_function[do_tri_test] = (lp_jit_frag_func)pointer_to_func(f);
if (gallivm_debug & GALLIVM_DEBUG_ASM) {
lp_disassemble(f);
*/
+#include "util/u_pointer.h"
#include "gallivm/lp_bld_type.h"
#include "gallivm/lp_bld_const.h"
#include "gallivm/lp_bld_conv.h"
typedef void (*conv_test_ptr_t)(const void *src, const void *dst);
-/** cast wrapper */
-static conv_test_ptr_t
-voidptr_to_conv_test_ptr_t(void *p)
-{
- union {
- void *v;
- conv_test_ptr_t f;
- } u;
- u.v = p;
- return u.f;
-}
void
write_tsv_header(FILE *fp)
LLVMDumpModule(module);
code = LLVMGetPointerToGlobal(engine, func);
- conv_test_ptr = voidptr_to_conv_test_ptr_t(code);
+ conv_test_ptr = (conv_test_ptr_t)pointer_to_func(code);
if(verbose >= 2)
lp_disassemble(code);
#include <llvm-c/Transforms/Scalar.h>
#include "util/u_memory.h"
+#include "util/u_pointer.h"
#include "util/u_format.h"
#include "util/u_format_tests.h"
#include "util/u_format_s3tc.h"
(*fetch_ptr_t)(float *, const void *packed,
unsigned i, unsigned j);
-/** cast wrapper to avoid warnings */
-static fetch_ptr_t
-void_to_fetch_ptr_t(void *p)
-{
- union {
- void *v;
- fetch_ptr_t f;
- } u;
- u.v = p;
- return u.f;
-}
-
-
static LLVMValueRef
add_fetch_rgba_test(LLVMModuleRef lp_build_module,
(void)pass;
#endif
- fetch_ptr = void_to_fetch_ptr_t(LLVMGetPointerToGlobal(lp_build_engine, fetch));
+ fetch_ptr = (fetch_ptr_t)pointer_to_func(LLVMGetPointerToGlobal(lp_build_engine, fetch));
for (i = 0; i < desc->block.height; ++i) {
for (j = 0; j < desc->block.width; ++j) {
#include <stdlib.h>
#include <stdio.h>
+#include "util/u_pointer.h"
#include "gallivm/lp_bld.h"
#include "gallivm/lp_bld_printf.h"
typedef void (*test_printf_t)(int i);
-/** cast wrapper */
-static test_printf_t
-voidptr_to_test_printf_t(void *p)
-{
- union {
- void *v;
- test_printf_t f;
- } u;
- u.v = p;
- return u.f;
-}
-
static LLVMValueRef
add_printf_test(LLVMModuleRef module)
#endif
code = LLVMGetPointerToGlobal(engine, test);
- test_printf = voidptr_to_test_printf_t(code);
+ test_printf = (test_printf_t)pointer_to_func(code);
memset(unpacked, 0, sizeof unpacked);
packed = 0;