make visual studio 6 compile/run (doesn't support 'long long int', so replace by char* pointers...

This commit is contained in:
ejcoumans
2007-09-10 01:53:07 +00:00
parent f7adab78f1
commit ab33083a9c
4 changed files with 43 additions and 40 deletions

View File

@@ -350,8 +350,8 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendly(btCollisio
BEGIN_PROFILE("refreshManifolds");
int numActiveBodies = 0;
for (int i=0;i<numBodies;i++)
int i;
for (i=0;i<numBodies;i++)
{
btRigidBody* rb = btRigidBody::upcast(bodies[i]);
if (rb && (rb->getIslandTag() >= 0))
@@ -363,7 +363,6 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendly(btCollisio
int numActiveManifolds = 0;
int totalContacts = 0;
int i;
for (i=0;i<numManifolds;i++)
{
btPersistentManifold* manifold = manifoldPtr[i];

View File

@@ -23,10 +23,10 @@ class btQuadWordStorage
{
protected:
#ifdef BT_USE_DOUBLE_PRECISION
union { btScalar m_x; unsigned long long int m_intx; unsigned char m_charx[8] ;};
union { btScalar m_y; unsigned long long int m_inty; unsigned char m_chary[8] ; };
union { btScalar m_z; unsigned long long int m_intz; unsigned char m_charz[8] ; };
union { btScalar m_unusedW; unsigned long long int m_intw; unsigned char m_charw[8] ; };
union { btScalar m_x; unsigned char m_charx[8] ;};
union { btScalar m_y; unsigned char m_chary[8] ; };
union { btScalar m_z; unsigned char m_charz[8] ; };
union { btScalar m_unusedW; unsigned char m_charw[8] ; };
#else
union { btScalar m_x; unsigned int m_intx; unsigned char m_charx[4] ;};
union { btScalar m_y; unsigned int m_inty; unsigned char m_chary[4] ; };
@@ -71,39 +71,47 @@ class btQuadWord : public btQuadWordStorage
SIMD_FORCE_INLINE operator const btScalar *() const { return &m_x; }
#ifdef BT_USE_DOUBLE_PRECISION
SIMD_FORCE_INLINE unsigned long long int getLongIntXValue() const
SIMD_FORCE_INLINE const unsigned char* getLongIntXValue() const
{
return m_intx;
return &m_charx[0];
}
SIMD_FORCE_INLINE unsigned long long int getLongIntYValue() const
SIMD_FORCE_INLINE const unsigned char* getLongIntYValue() const
{
return m_inty;
return &m_chary[0];;
}
SIMD_FORCE_INLINE unsigned long long int getLongIntZValue() const
SIMD_FORCE_INLINE const unsigned char* getLongIntZValue() const
{
return m_intz;
return &m_charz[0];;
}
SIMD_FORCE_INLINE unsigned long long int getLongIntWValue() const
SIMD_FORCE_INLINE const unsigned char* getLongIntWValue() const
{
return m_intw;
return &m_charw[0];;
}
SIMD_FORCE_INLINE void setXValueByLongInt(unsigned long long int intval)
SIMD_FORCE_INLINE void setXValueByLongInt(unsigned char* intval)
{
m_intx = intval;
int i;
for (i=0;i<8;i++)
m_charx[i] = intval[i];
}
SIMD_FORCE_INLINE void setYValueByLongInt(unsigned long long int intval)
SIMD_FORCE_INLINE void setYValueByLongInt(unsigned char* intval)
{
m_inty = intval;
int i;
for (i=0;i<8;i++)
m_chary[i] = intval[i];
}
SIMD_FORCE_INLINE void setZValueByLongInt(unsigned long long int intval)
SIMD_FORCE_INLINE void setZValueByLongInt(unsigned char* intval)
{
m_intz = intval;
int i;
for (i=0;i<8;i++)
m_charz[i] = intval[i];
}
SIMD_FORCE_INLINE void setWValueByLongInt(unsigned long long int intval)
SIMD_FORCE_INLINE void setWValueByLongInt(unsigned char* intval)
{
m_intz = intval;
int i;
for (i=0;i<8;i++)
m_charw[i] = intval[i];
}
#else
SIMD_FORCE_INLINE unsigned int getIntXValue() const

View File

@@ -281,10 +281,8 @@ SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a)
// swap using char pointers
SIMD_FORCE_INLINE unsigned long long btSwapEndianDouble(double d)
SIMD_FORCE_INLINE void btSwapEndianDouble(double d, unsigned char* dst)
{
unsigned long long a;
unsigned char *dst = (unsigned char *)&a;
unsigned char *src = (unsigned char *)&d;
dst[0] = src[7];
@@ -296,14 +294,12 @@ SIMD_FORCE_INLINE unsigned long long btSwapEndianDouble(double d)
dst[6] = src[1];
dst[7] = src[0];
return a;
}
// unswap using char pointers
SIMD_FORCE_INLINE double btUnswapEndianDouble(unsigned long long a)
SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src)
{
double d;
unsigned char *src = (unsigned char *)&a;
unsigned char *dst = (unsigned char *)&d;
dst[0] = src[7];
@@ -315,7 +311,7 @@ SIMD_FORCE_INLINE double btUnswapEndianDouble(unsigned long long a)
dst[6] = src[1];
dst[7] = src[0];
return d;
return d;
}

View File

@@ -408,14 +408,14 @@ public:
SIMD_FORCE_INLINE void btSwapVector3Endian(const btVector3& source, btVector3& dest)
{
#ifdef BT_USE_DOUBLE_PRECISION
unsigned long long int tmp;
tmp = btSwapDouble(source.getX());
unsigned char tmp[8];
btSwapEndianDouble(source.getX(),tmp);
dest.setXValueByLongInt(tmp);
tmp = btSwapDouble(source.getY());
btSwapEndianDouble(source.getY(),tmp);
dest.setYValueByLongInt(tmp);
tmp = btSwapDouble(source.getZ());
btSwapEndianDouble(source.getZ(),tmp);
dest.setZValueByLongInt(tmp);
tmp = btSwapDouble(source[3]);
btSwapEndianDouble(source[3],tmp);
dest.setWValueByLongInt(tmp);
#else
unsigned int tmp;
@@ -433,15 +433,15 @@ SIMD_FORCE_INLINE void btSwapVector3Endian(const btVector3& source, btVector3& d
SIMD_FORCE_INLINE void btUnSwapVector3Endian(btVector3& vector)
{
#ifdef BT_USE_DOUBLE_PRECISION
unsigned long long int tmp;
const unsigned char* tmp;
tmp = vector.getLongIntXValue();
vector.setX( btUnswapDouble(tmp));
vector.setX( btUnswapEndianDouble(tmp));
tmp = vector.getLongIntYValue();
vector.setY( btUnswapDouble(tmp));
vector.setY( btUnswapEndianDouble(tmp));
tmp = vector.getLongIntZValue();
vector.setZ( btUnswapDouble(tmp));
vector.setZ( btUnswapEndianDouble(tmp));
tmp = vector.getLongIntWValue();
vector[3] = btUnswapDouble(tmp);
vector[3] = btUnswapEndianDouble(tmp);
#else
unsigned int tmp;
tmp = vector.getIntXValue();