From cd3162f57831fd0b8d9af6bfcd08a521ab352386 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 17 Aug 2007 11:40:06 -0600 Subject: added align16() function --- src/mesa/pipe/p_util.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mesa/pipe') 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 ) { -- cgit v1.2.3