From 35f489f697c98618fc0d34e10a2913a1a8f6d828 Mon Sep 17 00:00:00 2001 From: Vladimir Orlov Date: Mon, 19 Oct 2020 20:59:36 +0200 Subject: [PATCH] Compilation warning fixes: * new btSdfCollisionShapeInternalData() may not be allocated aligned 16 * Two cases of signed/unsigned mismatch --- src/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp | 5 ++++- src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp | 2 +- src/LinearMath/btReducedVector.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp b/src/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp index 4a95dbea4..23c95ad3f 100644 --- a/src/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp +++ b/src/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp @@ -2,8 +2,11 @@ #include "btMiniSDF.h" #include "LinearMath/btAabbUtil2.h" -struct btSdfCollisionShapeInternalData +ATTRIBUTE_ALIGNED16(struct) +btSdfCollisionShapeInternalData { + BT_DECLARE_ALIGNED_ALLOCATOR(); + btVector3 m_localScaling; btScalar m_margin; btMiniSDF m_sdf; diff --git a/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp b/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp index 27f76b842..0f5ed1c2c 100644 --- a/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp +++ b/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp @@ -852,7 +852,7 @@ static void setupSpatialGridBatchesMt( memHelper.addChunk((void**)&constraintRowBatchIds, sizeof(int) * numConstraintRows); size_t scratchSize = memHelper.getSizeToAllocate(); // if we need to reallocate - if (scratchMemory->capacity() < scratchSize) + if (static_cast(scratchMemory->capacity()) < scratchSize) { // allocate 6.25% extra to avoid repeated reallocs scratchMemory->reserve(scratchSize + scratchSize / 16); diff --git a/src/LinearMath/btReducedVector.h b/src/LinearMath/btReducedVector.h index 83b5e581e..313a4271f 100644 --- a/src/LinearMath/btReducedVector.h +++ b/src/LinearMath/btReducedVector.h @@ -267,7 +267,7 @@ public: std::sort(tuples.begin(), tuples.end()); btAlignedObjectArray new_indices; btAlignedObjectArray new_vecs; - for (int i = 0; i < tuples.size(); ++i) + for (size_t i = 0; i < tuples.size(); ++i) { new_indices.push_back(tuples[i].b); new_vecs.push_back(m_vecs[tuples[i].a]);