diff options
author | Dave Parks <davep@lindenlab.com> | 2013-03-04 18:01:42 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-03-04 18:01:42 -0600 |
commit | 609ed855e1160505238378a1be49e2b92e8496f5 (patch) | |
tree | aed340024162360eaf026f29e50a633e77926036 /indra/llcommon/llmemory.h | |
parent | eb859ce5c18d4310ae4828d6964b2e8c088ee95f (diff) |
MAINT-2371 More optimizations.
Reviewed by Graham
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r-- | indra/llcommon/llmemory.h | 13 |
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 |