Skip to content

Commit e792f90

Browse files
authored
Merge pull request #2416 from nim65s/issue/2304
contact-info: cache nv, fix #2304
2 parents 52d1e7a + 3720a89 commit e792f90

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99
### Fixed
1010
- Fix linkage of Boost.Serialization on Windows ([#2400](https://github.com/stack-of-tasks/pinocchio/pull/2400))
1111
- Fix mjcf parser appending of inertias at root joint ([#2403](https://github.com/stack-of-tasks/pinocchio/pull/2403))
12+
- Fix unit tests with GCC 13.3 ([#2406](https://github.com/stack-of-tasks/pinocchio/pull/2416)
1213

1314
## [3.2.0] - 2024-08-27
1415

include/pinocchio/algorithm/contact-info.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,10 @@ namespace pinocchio
742742
if (current1_id > current2_id)
743743
{
744744
const JointModel & joint1 = model.joints[current1_id];
745+
const int j1nv = joint1.nv();
745746
joint1_span_indexes.push_back((Eigen::DenseIndex)current1_id);
746747
Eigen::DenseIndex current1_col_id = joint1.idx_v();
747-
for (int k = 0; k < joint1.nv(); ++k, ++current1_col_id)
748+
for (int k = 0; k < j1nv; ++k, ++current1_col_id)
748749
{
749750
colwise_joint1_sparsity[current1_col_id] = true;
750751
}
@@ -753,9 +754,10 @@ namespace pinocchio
753754
else
754755
{
755756
const JointModel & joint2 = model.joints[current2_id];
757+
const int j2nv = joint2.nv();
756758
joint2_span_indexes.push_back((Eigen::DenseIndex)current2_id);
757759
Eigen::DenseIndex current2_col_id = joint2.idx_v();
758-
for (int k = 0; k < joint2.nv(); ++k, ++current2_col_id)
760+
for (int k = 0; k < j2nv; ++k, ++current2_col_id)
759761
{
760762
colwise_joint2_sparsity[current2_col_id] = true;
761763
}
@@ -770,10 +772,11 @@ namespace pinocchio
770772
while (current_id > 0)
771773
{
772774
const JointModel & joint = model.joints[current_id];
775+
const int jnv = joint.nv();
773776
joint1_span_indexes.push_back((Eigen::DenseIndex)current_id);
774777
joint2_span_indexes.push_back((Eigen::DenseIndex)current_id);
775778
Eigen::DenseIndex current_row_id = joint.idx_v();
776-
for (int k = 0; k < joint.nv(); ++k, ++current_row_id)
779+
for (int k = 0; k < jnv; ++k, ++current_row_id)
777780
{
778781
colwise_joint1_sparsity[current_row_id] = true;
779782
colwise_joint2_sparsity[current_row_id] = true;

0 commit comments

Comments
 (0)