We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bf12f9 commit c2da564Copy full SHA for c2da564
include/eigenpy/alignment.hpp
@@ -29,6 +29,18 @@ struct aligned_instance {
29
typename aligned_storage<sizeof(Data)>::type storage;
30
};
31
32
+inline void *aligned_malloc(
33
+ std::size_t size, std::size_t alignment = EIGENPY_DEFAULT_ALIGN_BYTES) {
34
+ void *original = std::malloc(size + alignment);
35
+ if (original == 0) return 0;
36
+ void *aligned =
37
+ reinterpret_cast<void *>((reinterpret_cast<std::size_t>(original) &
38
+ ~(std::size_t(alignment - 1))) +
39
+ alignment);
40
+ *(reinterpret_cast<void **>(aligned) - 1) = original;
41
+ return aligned;
42
+}
43
+
44
} // namespace eigenpy
45
46
namespace boost {
0 commit comments