#include "p_compiler.h"
#include "p_debug.h"
+#include "p_pointer.h"
#include <math.h>
#define CALLOC_STRUCT(T) (struct T *) CALLOC(1, sizeof(struct T))
-/**
- * Return a pointer aligned to next multiple of N bytes.
- */
-static INLINE void *
-align_pointer( void *unaligned, uint alignment )
-{
- if (sizeof(void *) == 64) {
- union {
- void *p;
- uint64 u;
- } pu;
- pu.p = unaligned;
- pu.u = (pu.u + alignment - 1) & ~(uint64) (alignment - 1);
- return pu.p;
- }
- else {
- /* 32-bit pointers */
- union {
- void *p;
- uint u;
- } pu;
- pu.p = unaligned;
- pu.u = (pu.u + alignment - 1) & ~(alignment - 1);
- return pu.p;
- }
-}
-
/**
* Return memory on given byte alignment
*/