summaryrefslogtreecommitdiff
path: root/indra/llmath/tests
diff options
context:
space:
mode:
authorMaximB ProductEngine <mberezhnoy@productengine.com>2012-10-18 22:29:02 +0300
committerMaximB ProductEngine <mberezhnoy@productengine.com>2012-10-18 22:29:02 +0300
commitc43cfcdcbd243410e2f780f58f93100e96fc996c (patch)
treed5daa0187843a9302c1011937d452d40692d0d1a /indra/llmath/tests
parentc0b60841ce14a1c449ede17284d2aa6939322be3 (diff)
parentf9c068462f379a4678e59090a066cfa173504c6b (diff)
merge into latest changes
Diffstat (limited to 'indra/llmath/tests')
-rw-r--r--indra/llmath/tests/alignment_test.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/indra/llmath/tests/alignment_test.cpp b/indra/llmath/tests/alignment_test.cpp
index 49c668d737..9105b1c1fd 100644
--- a/indra/llmath/tests/alignment_test.cpp
+++ b/indra/llmath/tests/alignment_test.cpp
@@ -34,16 +34,6 @@
#include "../llsimdmath.h"
#include "../llvector4a.h"
-void* operator new(size_t size)
-{
- return ll_aligned_malloc_16(size);
-}
-
-void operator delete(void *p)
-{
- ll_aligned_free_16(p);
-}
-
namespace tut
{
@@ -59,6 +49,27 @@ tut::alignment_test_t tut_alignment_test("LLAlignment");
LL_ALIGN_PREFIX(16)
class MyVector4a
{
+public:
+ void* operator new(size_t size)
+ {
+ return ll_aligned_malloc_16(size);
+ }
+
+ void operator delete(void *p)
+ {
+ ll_aligned_free_16(p);
+ }
+
+ void* operator new[](size_t count)
+ { // try to allocate count bytes for an array
+ return ll_aligned_malloc_16(count);
+ }
+
+ void operator delete[](void *p)
+ {
+ ll_aligned_free_16(p);
+ }
+
LLQuad mQ;
} LL_ALIGN_POSTFIX(16);
@@ -78,12 +89,8 @@ void alignment_test_object_t::test<1>()
align_ptr = ll_aligned_malloc_16(sizeof(MyVector4a));
ensure("ll_aligned_malloc_16 failed", is_aligned(align_ptr,16));
-#if !LL_LINUX
- // Skipping realloc alignment test on Linux because the ll_aligned_realloc_16()
- // function is not implemented to ensure alignment on Linux (see llmemory.h)
- align_ptr = ll_aligned_realloc_16(align_ptr,2*sizeof(MyVector4a));
+ align_ptr = ll_aligned_realloc_16(align_ptr,2*sizeof(MyVector4a), sizeof(MyVector4a));
ensure("ll_aligned_realloc_16 failed", is_aligned(align_ptr,16));
-#endif // LL_LINUX
ll_aligned_free_16(align_ptr);