35 #include <gtest/gtest.h> 41 TEST(AlignedAlloc, mallocfree)
43 for (
size_t i = 1;i < 100000; ++i)
46 ASSERT_TRUE((((uintptr_t)mem) & 127) == 0);
52 TEST(AlignedAlloc, stlAllocator)
54 for (
size_t i = 1;i < 20000; ++i)
56 std::vector<uint8_t, AlignedAllocator<uint8_t, 128> > v;
58 ASSERT_TRUE((((uintptr_t)&v.front()) & 127) == 0);
62 int main(
int argc,
char** argv)
64 testing::InitGoogleTest(&argc, argv);
65 return RUN_ALL_TESTS();
TEST(AlignedAlloc, mallocfree)
int main(int argc, char **argv)
void * alignedMalloc(size_t size, size_t alignment)
Allocate memory aligned at on a value. Memory allocated through alignedMalloc() must be freed through...
void alignedFree(void *aligned)
Free memory allocated through alignedMalloc()