From: Brian Date: Fri, 17 Aug 2007 17:40:06 +0000 (-0600) Subject: added align16() function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd3162f57831fd0b8d9af6bfcd08a521ab352386;p=mesa.git added align16() function --- diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h index 69b69a3c67d..3eff3328c78 100644 --- a/src/mesa/pipe/p_util.h +++ b/src/mesa/pipe/p_util.h @@ -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 ) {