summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2011-12-21 17:02:47 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2011-12-21 17:02:47 -0500
commitc8682722ad6b889b13ce288c417cb6b82ed273ac (patch)
tree234f76107be807c1bd36d8c1664364ee17421507 /indra/llcommon
parent461241a6300dcf29b06b2403c824fefd1d91a8fd (diff)
SH-2789 WIP - aligned alloc and realloc
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-xindra/llcommon/llmemory.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index c61d06e924..3eaf700bf1 100755
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -46,7 +46,7 @@ inline void ll_aligned_free( void* ptr )
inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
{
#if defined(LL_WINDOWS)
- return _mm_malloc(size, 16);
+ return _aligned_malloc(size, 16);
#elif defined(LL_DARWIN)
return malloc(size); // default osx malloc is 16 byte aligned.
#else
@@ -58,10 +58,21 @@ inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed wi
#endif
}
+inline void* ll_aligned_realloc_16(void* ptr, size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
+{
+#if defined(LL_WINDOWS)
+ return _aligned_realloc(ptr, size, 16);
+#elif defined(LL_DARWIN)
+ return realloc(ptr,size); // default osx malloc is 16 byte aligned.
+#else
+ return realloc(ptr,size); // FIXME not guaranteed to be aligned.
+#endif
+}
+
inline void ll_aligned_free_16(void *p)
{
#if defined(LL_WINDOWS)
- _mm_free(p);
+ _aligned_free(p);
#elif defined(LL_DARWIN)
return free(p);
#else