summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_pointer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_pointer.h')
-rw-r--r--src/gallium/auxiliary/util/u_pointer.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_pointer.h b/src/gallium/auxiliary/util/u_pointer.h
index e1af9f11cb9..cce0c7430e7 100644
--- a/src/gallium/auxiliary/util/u_pointer.h
+++ b/src/gallium/auxiliary/util/u_pointer.h
@@ -98,6 +98,29 @@ align16( void *unaligned )
return align_pointer( unaligned, 16 );
}
+typedef void (*func_pointer)(void);
+
+static INLINE func_pointer
+pointer_to_func( void *p )
+{
+ union {
+ void *p;
+ func_pointer f;
+ } pf;
+ pf.p = p;
+ return pf.f;
+}
+
+static INLINE void *
+func_to_pointer( func_pointer f )
+{
+ union {
+ void *p;
+ func_pointer f;
+ } pf;
+ pf.f = f;
+ return pf.p;
+}
#ifdef __cplusplus