projects
/
platform
/
upstream
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18fb9ff
)
util: Generic pointer to func conversion helper.
author
José Fonseca
<jfonseca@vmware.com>
Sun, 30 May 2010 15:36:08 +0000
(16:36 +0100)
committer
José Fonseca
<jfonseca@vmware.com>
Sun, 30 May 2010 15:36:08 +0000
(16:36 +0100)
That observes strict-aliasing rules.
src/gallium/auxiliary/util/u_pointer.h
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_pointer.h
b/src/gallium/auxiliary/util/u_pointer.h
index
e1af9f1
..
ae6f43b
100644
(file)
--- a/
src/gallium/auxiliary/util/u_pointer.h
+++ b/
src/gallium/auxiliary/util/u_pointer.h
@@
-98,6
+98,18
@@
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;
+}
#ifdef __cplusplus