summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llmemory.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index e725bdd9fa..46cabfadcd 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -38,17 +38,28 @@ class LLMutex ;
inline void* ll_aligned_malloc( size_t size, int align )
{
+#if defined(LL_WINDOWS)
+ return _aligned_malloc(size, align);
+#else
void* mem = malloc( size + (align - 1) + sizeof(void*) );
char* aligned = ((char*)mem) + sizeof(void*);
aligned += align - ((uintptr_t)aligned & (align - 1));
((void**)aligned)[-1] = mem;
return aligned;
+#endif
}
inline void ll_aligned_free( void* ptr )
{
- free( ((void**)ptr)[-1] );
+#if defined(LL_WINDOWS)
+ _aligned_free(ptr);
+#else
+ if (ptr)
+ {
+ free( ((void**)ptr)[-1] );
+ }
+#endif
}
#if !LL_USE_TCMALLOC