mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
util: Generic pointer to func conversion helper.
That observes strict-aliasing rules.
This commit is contained in:
parent
18fb9ff6d8
commit
6f67a71aad
1 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue