MCPcopy Create free account
hub / github.com/Derious/cuMPC / EIGEN_DECLARE_TEST

Function EIGEN_DECLARE_TEST

dependence/eigen-3.4.0/test/dynalloc.cpp:123–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123EIGEN_DECLARE_TEST(dynalloc)
124{
125 // low level dynamic memory allocation
126 CALL_SUBTEST(check_handmade_aligned_malloc());
127 CALL_SUBTEST(check_aligned_malloc());
128 CALL_SUBTEST(check_aligned_new());
129 CALL_SUBTEST(check_aligned_stack_alloc());
130
131 for (int i=0; i<g_repeat*100; ++i)
132 {
133 CALL_SUBTEST( check_custom_new_delete<Vector4f>() );
134 CALL_SUBTEST( check_custom_new_delete<Vector2f>() );
135 CALL_SUBTEST( check_custom_new_delete<Matrix4f>() );
136 CALL_SUBTEST( check_custom_new_delete<MatrixXi>() );
137 }
138
139 // check static allocation, who knows ?
140 #if EIGEN_MAX_STATIC_ALIGN_BYTES
141 for (int i=0; i<g_repeat*100; ++i)
142 {
143 CALL_SUBTEST(check_dynaligned<Vector4f>() );
144 CALL_SUBTEST(check_dynaligned<Vector2d>() );
145 CALL_SUBTEST(check_dynaligned<Matrix4f>() );
146 CALL_SUBTEST(check_dynaligned<Vector4d>() );
147 CALL_SUBTEST(check_dynaligned<Vector4i>() );
148 CALL_SUBTEST(check_dynaligned<Vector8f>() );
149 CALL_SUBTEST(check_dynaligned<Vector16f>() );
150 }
151
152 {
153 MyStruct foo0; VERIFY(internal::UIntPtr(foo0.avec.data())%ALIGNMENT==0);
154 MyClassA fooA; VERIFY(internal::UIntPtr(fooA.avec.data())%ALIGNMENT==0);
155 }
156
157 // dynamic allocation, single object
158 for (int i=0; i<g_repeat*100; ++i)
159 {
160 MyStruct *foo0 = new MyStruct(); VERIFY(internal::UIntPtr(foo0->avec.data())%ALIGNMENT==0);
161 MyClassA *fooA = new MyClassA(); VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0);
162 delete foo0;
163 delete fooA;
164 }
165
166 // dynamic allocation, array
167 const int N = 10;
168 for (int i=0; i<g_repeat*100; ++i)
169 {
170 MyStruct *foo0 = new MyStruct[N]; VERIFY(internal::UIntPtr(foo0->avec.data())%ALIGNMENT==0);
171 MyClassA *fooA = new MyClassA[N]; VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0);
172 delete[] foo0;
173 delete[] fooA;
174 }
175 #endif
176
177}

Callers

nothing calls this directly

Calls 4

check_aligned_mallocFunction · 0.85
check_aligned_newFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected