summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-17 11:40:06 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-08-17 11:40:06 -0600
commitcd3162f57831fd0b8d9af6bfcd08a521ab352386 (patch)
tree3ea588f441fe9d57fa63d2d068384dc697b01300 /src
parent2fc54f5bb56a7714c843fc5a6a3bb6895af9babc (diff)
added align16() function
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/p_util.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 69b69a3c67..3eff3328c7 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 )
{