u_pointer.h File Reference

Include dependency graph for u_pointer.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static intptr_t pointer_to_intptr (const void *p)
static void * intptr_to_pointer (intptr_t i)
static uintptr_t pointer_to_uintptr (const void *ptr)
static void * uintptr_to_pointer (uintptr_t u)
static void * align_pointer (const void *unaligned, uintptr_t alignment)
 Return a pointer aligned to next multiple of N bytes.
static void * align16 (void *unaligned)
 Return a pointer aligned to next multiple of 16 bytes.


Function Documentation

static void* align16 ( void *  unaligned  )  [static]

Return a pointer aligned to next multiple of 16 bytes.

Definition at line 96 of file u_pointer.h.

References align_pointer().

00097 {
00098    return align_pointer( unaligned, 16 );
00099 }

static void* align_pointer ( const void *  unaligned,
uintptr_t  alignment 
) [static]

Return a pointer aligned to next multiple of N bytes.

Definition at line 85 of file u_pointer.h.

References pointer_to_uintptr(), and uintptr_to_pointer().

00086 {
00087    uintptr_t aligned = (pointer_to_uintptr( unaligned ) + alignment - 1) & ~(alignment - 1);
00088    return uintptr_to_pointer( aligned );
00089 }

static void* intptr_to_pointer ( intptr_t  i  )  [static]

Definition at line 49 of file u_pointer.h.

00050 {
00051    union {
00052       void *p;
00053       intptr_t i;
00054    } pi;
00055    pi.i = i;
00056    return pi.p;
00057 }

static intptr_t pointer_to_intptr ( const void *  p  )  [static]

Definition at line 38 of file u_pointer.h.

00039 {
00040    union {
00041       const void *p;
00042       intptr_t i;
00043    } pi;
00044    pi.p = p;
00045    return pi.i;
00046 }

static uintptr_t pointer_to_uintptr ( const void *  ptr  )  [static]

Definition at line 60 of file u_pointer.h.

00061 {
00062    union {
00063       const void *p;
00064       uintptr_t u;
00065    } pu;
00066    pu.p = ptr;
00067    return pu.u;
00068 }

static void* uintptr_to_pointer ( uintptr_t  u  )  [static]

Definition at line 71 of file u_pointer.h.

00072 {
00073    union {
00074       void *p;
00075       uintptr_t u;
00076    } pu;
00077    pu.u = u;
00078    return pu.p;
00079 }


Generated on Tue Sep 29 06:25:29 2009 for Gallium3D by  doxygen 1.5.4