2008-08-25 00:48:55 +01:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Copyright 2007-2008 VMware, Inc.
|
2008-08-25 00:48:55 +01:00
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
* 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.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
2008-08-25 00:48:55 +01:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef U_POINTER_H
|
|
|
|
#define U_POINTER_H
|
|
|
|
|
2022-07-01 03:25:19 +01:00
|
|
|
#include <stdint.h>
|
2008-08-25 00:48:55 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline intptr_t
|
2008-08-25 00:48:55 +01:00
|
|
|
pointer_to_intptr( const void *p )
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
const void *p;
|
|
|
|
intptr_t i;
|
|
|
|
} pi;
|
|
|
|
pi.p = p;
|
|
|
|
return pi.i;
|
|
|
|
}
|
|
|
|
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline void *
|
2008-08-25 00:48:55 +01:00
|
|
|
intptr_to_pointer( intptr_t i )
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
void *p;
|
|
|
|
intptr_t i;
|
|
|
|
} pi;
|
|
|
|
pi.i = i;
|
|
|
|
return pi.p;
|
|
|
|
}
|
|
|
|
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline uintptr_t
|
2008-08-25 00:48:55 +01:00
|
|
|
pointer_to_uintptr( const void *ptr )
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
const void *p;
|
|
|
|
uintptr_t u;
|
|
|
|
} pu;
|
|
|
|
pu.p = ptr;
|
|
|
|
return pu.u;
|
|
|
|
}
|
|
|
|
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline void *
|
2008-08-25 00:48:55 +01:00
|
|
|
uintptr_to_pointer( uintptr_t u )
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
void *p;
|
|
|
|
uintptr_t u;
|
|
|
|
} pu;
|
|
|
|
pu.u = u;
|
|
|
|
return pu.p;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a pointer aligned to next multiple of N bytes.
|
|
|
|
*/
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline void *
|
2008-08-25 00:48:55 +01:00
|
|
|
align_pointer( const void *unaligned, uintptr_t alignment )
|
|
|
|
{
|
|
|
|
uintptr_t aligned = (pointer_to_uintptr( unaligned ) + alignment - 1) & ~(alignment - 1);
|
|
|
|
return uintptr_to_pointer( aligned );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a pointer aligned to next multiple of 16 bytes.
|
|
|
|
*/
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline void *
|
2008-08-25 00:48:55 +01:00
|
|
|
align16( void *unaligned )
|
|
|
|
{
|
|
|
|
return align_pointer( unaligned, 16 );
|
|
|
|
}
|
|
|
|
|
2010-05-30 16:36:08 +01:00
|
|
|
typedef void (*func_pointer)(void);
|
|
|
|
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline func_pointer
|
2010-05-30 16:36:08 +01:00
|
|
|
pointer_to_func( void *p )
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
void *p;
|
|
|
|
func_pointer f;
|
|
|
|
} pf;
|
|
|
|
pf.p = p;
|
|
|
|
return pf.f;
|
|
|
|
}
|
2008-08-25 00:48:55 +01:00
|
|
|
|
2015-07-21 00:58:43 +01:00
|
|
|
static inline void *
|
2010-06-10 16:22:49 +01:00
|
|
|
func_to_pointer( func_pointer f )
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
void *p;
|
|
|
|
func_pointer f;
|
|
|
|
} pf;
|
|
|
|
pf.f = f;
|
|
|
|
return pf.p;
|
|
|
|
}
|
|
|
|
|
2008-08-25 00:48:55 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* U_POINTER_H */
|