/**************************************************************************
*
- * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007-2008 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern "C" {
#endif
-static INLINE intptr_t
+static inline intptr_t
pointer_to_intptr( const void *p )
{
union {
return pi.i;
}
-static INLINE void *
+static inline void *
intptr_to_pointer( intptr_t i )
{
union {
return pi.p;
}
-static INLINE uintptr_t
+static inline uintptr_t
pointer_to_uintptr( const void *ptr )
{
union {
return pu.u;
}
-static INLINE void *
+static inline void *
uintptr_to_pointer( uintptr_t u )
{
union {
/**
* Return a pointer aligned to next multiple of N bytes.
*/
-static INLINE void *
+static inline void *
align_pointer( const void *unaligned, uintptr_t alignment )
{
uintptr_t aligned = (pointer_to_uintptr( unaligned ) + alignment - 1) & ~(alignment - 1);
/**
* Return a pointer aligned to next multiple of 16 bytes.
*/
-static INLINE void *
+static inline void *
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