Skip to content

Commit

Permalink
tests: mem_cast_tr, murmur3: properly use etl::aligned_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Dorniak committed Jun 25, 2024
1 parent 5489e9f commit 3e16709
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
6 changes: 1 addition & 5 deletions test/test_mem_cast_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ namespace
return reinterpret_cast<char*>(uintptr_t(i));
}

#if __cplusplus >= 202302L
alignas(Alignment) uint8_t buffer[Size];
#else
typename std::aligned_storage<Size, Alignment>::type buffer;
#endif
etl::aligned_storage<Size, Alignment>::type buffer;

SUITE(test_mem_cast_ptr)
{
Expand Down
19 changes: 4 additions & 15 deletions test/test_murmur3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SOFTWARE.
#include <vector>
#include <stdint.h>

#include "etl/alignment.h"
#include "etl/murmur3.h"

namespace
Expand All @@ -44,11 +45,7 @@ namespace
//*************************************************************************
TEST(test_murmur3_32_constructor)
{
#if __cplusplus >= 202302L
alignas(uint32_t) uint8_t storage[10];
#else
typename std::aligned_storage<sizeof(char), std::alignment_of<uint32_t>::value>::type storage[10];
#endif
typename etl::aligned_storage<sizeof(char), std::alignment_of<uint32_t>::value>::type storage[10];
std::string data("123456789");

char* begin = (char*)&storage[0];
Expand All @@ -65,11 +62,7 @@ namespace
//*************************************************************************
TEST(test_murmur3_32_add_values)
{
#if __cplusplus >= 202302L
alignas(uint32_t) uint8_t storage[10];
#else
typename std::aligned_storage<sizeof(char), std::alignment_of<uint32_t>::value>::type storage[10];
#endif
typename etl::aligned_storage<sizeof(char), std::alignment_of<uint32_t>::value>::type storage[10];
std::string data("123456789");

char* begin = (char*)&storage[0];
Expand All @@ -93,11 +86,7 @@ namespace
//*************************************************************************
TEST(test_murmur3_32_add_range)
{
#if __cplusplus >= 202302L
alignas(uint32_t) uint8_t storage[10];
#else
typename std::aligned_storage<sizeof(char), std::alignment_of<uint32_t>::value>::type storage[10];
#endif
typename etl::aligned_storage<sizeof(char), std::alignment_of<uint32_t>::value>::type storage[10];
std::string data("123456789");

char* begin = (char*)&storage[0];
Expand Down

0 comments on commit 3e16709

Please sign in to comment.