Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eigenpy
Commits
77d83f5b
Verified
Commit
77d83f5b
authored
Feb 25, 2020
by
Justin Carpentier
Browse files
core: add is_aligned helper
parent
04aa3138
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
77d83f5b
...
...
@@ -74,6 +74,7 @@ SEARCH_FOR_BOOST()
SET
(
${
PROJECT_NAME
}
_UTILS_HEADERS
include/eigenpy/utils/scalar-name.hpp
include/eigenpy/utils/is-approx.hpp
include/eigenpy/utils/is-aligned.hpp
)
SET
(
${
PROJECT_NAME
}
_SOLVERS_HEADERS
...
...
include/eigenpy/eigen-allocator.hpp
View file @
77d83f5b
...
...
@@ -8,8 +8,7 @@
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/map.hpp"
#include
"eigenpy/scalar-conversion.hpp"
#include
<boost/align/is_aligned.hpp>
#include
"eigenpy/utils/is-aligned.hpp"
namespace
eigenpy
{
...
...
@@ -233,7 +232,7 @@ namespace eigenpy
if
(
Options
!=
Eigen
::
Unaligned
)
// we need to check whether the memory is correctly aligned and composed of a continuous segment
{
void
*
data_ptr
=
PyArray_DATA
(
pyArray
);
if
(
!
PyArray_ISONESEGMENT
(
pyArray
)
||
!
boost
::
alignment
::
is_aligned
(
Options
,
data_ptr
))
if
(
!
PyArray_ISONESEGMENT
(
pyArray
)
||
!
is_aligned
(
data_ptr
,
Option
))
need_to_allocate
|=
true
;
}
...
...
include/eigenpy/utils/is-aligned.hpp
0 → 100644
View file @
77d83f5b
//
// Copyright (c) 2020 INRIA
//
#ifndef __eigenpy_utils_is_aligned_hpp__
#define __eigenpy_utils_is_aligned_hpp__
namespace
eigenpy
{
inline
bool
is_aligned
(
void
*
ptr
,
std
::
size_t
alignment
)
{
return
(
reinterpret_cast
<
std
::
size_t
>
(
ptr
)
&
(
alignment
-
1
))
==
0
;
}
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment