diff options
Diffstat (limited to 'lib/mesa/src/util/ralloc.c')
-rw-r--r-- | lib/mesa/src/util/ralloc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/mesa/src/util/ralloc.c b/lib/mesa/src/util/ralloc.c index 42cfa2e39..5a7fa7e84 100644 --- a/lib/mesa/src/util/ralloc.c +++ b/lib/mesa/src/util/ralloc.c @@ -553,13 +553,19 @@ ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt, * other buffers. */ -#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1)) - #define MIN_LINEAR_BUFSIZE 2048 -#define SUBALLOC_ALIGNMENT sizeof(uintptr_t) +#define SUBALLOC_ALIGNMENT 8 #define LMAGIC 0x87b9c7d3 -struct linear_header { +struct +#ifdef _MSC_VER + __declspec(align(8)) +#elif defined(__LP64__) + __attribute__((aligned(16))) +#else + __attribute__((aligned(8))) +#endif + linear_header { #ifdef DEBUG unsigned magic; /* for debugging */ #endif @@ -653,6 +659,8 @@ linear_alloc_child(void *parent, unsigned size) ptr = (linear_size_chunk *)((char*)&latest[1] + latest->offset); ptr->size = size; latest->offset += full_size; + + assert((uintptr_t)&ptr[1] % SUBALLOC_ALIGNMENT == 0); return &ptr[1]; } |