diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-05 16:08:26 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-05 16:08:26 +0300 |
commit | 247a28f242c2c0a8931a84df0db6e60763642f30 (patch) | |
tree | cdd5721ab333967a5b4e0489ded5f29bf48610b4 /tests/gtests | |
parent | 5d79f9f276b4b3e6289308c534c58e7ee3bb5e2d (diff) |
Revert "BLI: refactor how buffers for small object optimization are stored"
This reverts commit 5d79f9f276b4b3e6289308c534c58e7ee3bb5e2d.
This was introducing build errors in windows. Need a bit more time to check it.
Diffstat (limited to 'tests/gtests')
-rw-r--r-- | tests/gtests/blenlib/BLI_array_test.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/gtests/blenlib/BLI_array_test.cc b/tests/gtests/blenlib/BLI_array_test.cc index b65402cd1fd..9c77c69e296 100644 --- a/tests/gtests/blenlib/BLI_array_test.cc +++ b/tests/gtests/blenlib/BLI_array_test.cc @@ -138,22 +138,23 @@ TEST(array, NoInitializationSizeConstructor) { using MyArray = Array<ConstructibleType>; - TypedBuffer<MyArray> buffer; - memset(buffer, 100, sizeof(MyArray)); + AlignedBuffer<sizeof(MyArray), alignof(MyArray)> buffer; + char *buffer_ptr = (char *)buffer.ptr(); + memset(buffer_ptr, 100, sizeof(MyArray)); /* Doing this to avoid some compiler optimization. */ for (uint i : IndexRange(sizeof(MyArray))) { - EXPECT_EQ(((char *)buffer.ptr())[i], 100); + EXPECT_EQ(buffer_ptr[i], 100); } { - MyArray &array = *new (buffer) MyArray(1, NoInitialization()); + MyArray &array = *new (buffer.ptr()) MyArray(1, NoInitialization()); EXPECT_EQ(array[0].value, 100); array.clear_without_destruct(); array.~Array(); } { - MyArray &array = *new (buffer) MyArray(1); + MyArray &array = *new (buffer.ptr()) MyArray(1); EXPECT_EQ(array[0].value, 42); array.~Array(); } |