summaryrefslogtreecommitdiff
path: root/indra/llmath/tests/alignment_test.cpp
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-09-20 19:43:54 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-09-20 19:43:54 -0700
commitc6a2ac0489859111276421d620abd156339c607d (patch)
tree1bfbeb5d0ddcedd77854e5e5c8b6ad675ed6ef3c /indra/llmath/tests/alignment_test.cpp
parentae127dc01ab10d407cf165ae2ad74060f65c1832 (diff)
parent29cdf94e95d0a4365bd18860c4759f9a6a13f45a (diff)
Pull and merge from ssh://hg@bitbucket.org/stinson_linden/viewer-beta-drtvwr-179.
Diffstat (limited to 'indra/llmath/tests/alignment_test.cpp')
-rw-r--r--indra/llmath/tests/alignment_test.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/indra/llmath/tests/alignment_test.cpp b/indra/llmath/tests/alignment_test.cpp
index ac0c45ae6f..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,7 +89,7 @@ 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));
- 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));
ll_aligned_free_16(align_ptr);