diff options
author | José Fonseca <[email protected]> | 2010-02-04 18:06:55 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2010-02-04 18:07:22 +0000 |
commit | 24ea02553efccc52581479819d8ead8d2bb06aaf (patch) | |
tree | aafe891282289e92b58ac9c94a124e0d2295671b /src/gallium/auxiliary/os | |
parent | 3aba0a28757e9b2a2f6a3f42fff955ccfd3fa4d4 (diff) |
os/os_memory_aligned.h: fix memory allocation alignment for 64 bits
Based on Andreia Gaita <[email protected]>'s patch.
Diffstat (limited to 'src/gallium/auxiliary/os')
-rw-r--r-- | src/gallium/auxiliary/os/os_memory.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/os/os_memory_aligned.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/os/os_memory.h b/src/gallium/auxiliary/os/os_memory.h index 704aa0762be..556662d35e1 100644 --- a/src/gallium/auxiliary/os/os_memory.h +++ b/src/gallium/auxiliary/os/os_memory.h @@ -58,7 +58,7 @@ void * os_realloc(void *ptr, size_t old_size, size_t new_size); void * -os_malloc_aligned(size_t size, uint alignment); +os_malloc_aligned(size_t size, size_t alignment); void os_free_aligned(void *ptr); diff --git a/src/gallium/auxiliary/os/os_memory_aligned.h b/src/gallium/auxiliary/os/os_memory_aligned.h index d4528f73196..72c5cf65b66 100644 --- a/src/gallium/auxiliary/os/os_memory_aligned.h +++ b/src/gallium/auxiliary/os/os_memory_aligned.h @@ -43,7 +43,7 @@ * Return memory on given byte alignment */ static INLINE void * -os_malloc_aligned(size_t size, uint alignment) +os_malloc_aligned(size_t size, size_t alignment) { char *ptr, *buf; @@ -51,7 +51,7 @@ os_malloc_aligned(size_t size, uint alignment) if (!ptr) return NULL; - buf = (char *)(((uintptr_t)ptr + sizeof(void *) + alignment - 1) & ~(alignment - 1)); + buf = (char *)(((uintptr_t)ptr + sizeof(void *) + alignment - 1) & ~((uintptr_t)(alignment - 1))); *(char **)(buf - sizeof(void *)) = ptr; return buf; |