added align16() function

This commit is contained in:
Brian 2007-08-17 11:40:06 -06:00
parent 2fc54f5bb5
commit cd3162f578
1 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,22 @@
#define Elements(x) sizeof(x)/sizeof(*(x))
/**
* Return pointer aligned to next multiple of 16 bytes.
*/
static INLINE void *
align16(void *unaligned)
{
union {
void *p;
uint64 u;
} pu;
pu.p = unaligned;
pu.u = (pu.u + 15) & ~15;
return pu.p;
}
#if defined(__MSC__) && defined(__WIN32__)
static INLINE unsigned ffs( unsigned u )
{