Skip to content
Snippets Groups Projects
Verified Commit 7a46ca05 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: fix aligned_malloc

parent c2da564f
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@
#include <boost/python/converter/arg_from_python.hpp>
#include <boost/python/converter/rvalue_from_python_data.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <eigenpy/utils/is-aligned.hpp>
namespace eigenpy {
......@@ -33,6 +34,7 @@ inline void *aligned_malloc(
std::size_t size, std::size_t alignment = EIGENPY_DEFAULT_ALIGN_BYTES) {
void *original = std::malloc(size + alignment);
if (original == 0) return 0;
if (is_aligned(original, alignment)) return original;
void *aligned =
reinterpret_cast<void *>((reinterpret_cast<std::size_t>(original) &
~(std::size_t(alignment - 1))) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment