Peer pressure :) Fix some very public (but probably harmless) errors in extern/bullet2, it will propagate to the Bullet soon from here:

https://www.assembla.com/code/bullet3/subversion/nodes
Thanks to Campbell for letting me know
Fixed described by Sean here:
http://stackoverflow.com/questions/818535/how-can-i-set-all-bits-to-1-in-a-binary-number-of-an-unknown-size
This commit is contained in:
Erwin Coumans 2012-04-24 05:28:19 +00:00
parent f02694f5a4
commit 782cf3f844
2 changed files with 6 additions and 2 deletions

@ -78,8 +78,10 @@ ATTRIBUTE_ALIGNED16 (struct) btQuantizedBvhNode
int getTriangleIndex() const int getTriangleIndex() const
{ {
btAssert(isLeafNode()); btAssert(isLeafNode());
unsigned int x=0;
unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
// Get only the lower bits where the triangle index is stored // Get only the lower bits where the triangle index is stored
return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS))); return (m_escapeIndexOrTriangleIndex&~(y));
} }
int getPartId() const int getPartId() const
{ {

@ -45,7 +45,9 @@ struct btTriIndex
int getTriangleIndex() const int getTriangleIndex() const
{ {
// Get only the lower bits where the triangle index is stored // Get only the lower bits where the triangle index is stored
return (m_PartIdTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS))); unsigned int x = 0;
unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
return (m_PartIdTriangleIndex&~(y));
} }
int getPartId() const int getPartId() const
{ {