forked from bartvdbraak/blender
Use Blender codestyle, not Google's one!
This commit is contained in:
parent
16d64a99b4
commit
a6e58cd761
@ -6,42 +6,46 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void DoBasicAlignmentChecks(const int alignment) {
|
void DoBasicAlignmentChecks(const int alignment)
|
||||||
int *foo, *bar;
|
{
|
||||||
|
int *foo, *bar;
|
||||||
|
|
||||||
foo = (int *) MEM_mallocN_aligned(sizeof(int) * 10, alignment, "test");
|
foo = (int *) MEM_mallocN_aligned(sizeof(int) * 10, alignment, "test");
|
||||||
CHECK_ALIGNMENT(foo, alignment);
|
CHECK_ALIGNMENT(foo, alignment);
|
||||||
|
|
||||||
bar = (int *) MEM_dupallocN(foo);
|
bar = (int *) MEM_dupallocN(foo);
|
||||||
CHECK_ALIGNMENT(bar, alignment);
|
CHECK_ALIGNMENT(bar, alignment);
|
||||||
MEM_freeN(bar);
|
MEM_freeN(bar);
|
||||||
|
|
||||||
foo = (int *) MEM_reallocN(foo, sizeof(int) * 5);
|
foo = (int *) MEM_reallocN(foo, sizeof(int) * 5);
|
||||||
CHECK_ALIGNMENT(foo, alignment);
|
CHECK_ALIGNMENT(foo, alignment);
|
||||||
|
|
||||||
foo = (int *) MEM_recallocN(foo, sizeof(int) * 5);
|
foo = (int *) MEM_recallocN(foo, sizeof(int) * 5);
|
||||||
CHECK_ALIGNMENT(foo, alignment);
|
CHECK_ALIGNMENT(foo, alignment);
|
||||||
|
|
||||||
MEM_freeN(foo);
|
MEM_freeN(foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(guardedalloc, LockfreeAlignedAlloc16) {
|
TEST(guardedalloc, LockfreeAlignedAlloc16)
|
||||||
DoBasicAlignmentChecks(16);
|
{
|
||||||
|
DoBasicAlignmentChecks(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(guardedalloc, GuardedAlignedAlloc16) {
|
TEST(guardedalloc, GuardedAlignedAlloc16)
|
||||||
MEM_use_guarded_allocator();
|
{
|
||||||
DoBasicAlignmentChecks(16);
|
MEM_use_guarded_allocator();
|
||||||
|
DoBasicAlignmentChecks(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Apple we currently support 16 bit alignment only.
|
// On Apple we currently support 16 bit alignment only.
|
||||||
// Harmless for Blender, but would be nice to support
|
// Harmless for Blender, but would be nice to support
|
||||||
// eventually.
|
// eventually.
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
TEST(guardedalloc, GuardedAlignedAlloc32) {
|
TEST(guardedalloc, GuardedAlignedAlloc32)
|
||||||
MEM_use_guarded_allocator();
|
{
|
||||||
DoBasicAlignmentChecks(16);
|
MEM_use_guarded_allocator();
|
||||||
|
DoBasicAlignmentChecks(16);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user