Francois Gouget : d3dx8: Make sure d3dx8math.inl compiles fine, whether nameless unions are supported or not.
Alexandre Julliard
julliard at winehq.org
Mon Oct 29 08:34:49 CDT 2007
Module: wine
Branch: master
Commit: 97f36631b5b4417f1e881dc1d0407a2f589eeb89
URL: http://source.winehq.org/git/wine.git/?a=commit;h=97f36631b5b4417f1e881dc1d0407a2f589eeb89
Author: Francois Gouget <fgouget at free.fr>
Date: Sun Oct 28 02:49:40 2007 +0200
d3dx8: Make sure d3dx8math.inl compiles fine, whether nameless unions are supported or not.
---
include/d3dx8math.inl | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 4df1f9e..22684a0 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -319,26 +319,31 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
}
/*__________________D3DXMatrix____________________*/
+#ifdef NONAMELESSUNION
+# define D3DX_U(x) (x).u
+#else
+# define D3DX_U(x) (x)
+#endif
static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout)
{
if ( !pout ) return NULL;
- pout->m[0][1] = 0.0f;
- pout->m[0][2] = 0.0f;
- pout->m[0][3] = 0.0f;
- pout->m[1][0] = 0.0f;
- pout->m[1][2] = 0.0f;
- pout->m[1][3] = 0.0f;
- pout->m[2][0] = 0.0f;
- pout->m[2][1] = 0.0f;
- pout->m[2][3] = 0.0f;
- pout->m[3][0] = 0.0f;
- pout->m[3][1] = 0.0f;
- pout->m[3][2] = 0.0f;
- pout->m[0][0] = 1.0f;
- pout->m[1][1] = 1.0f;
- pout->m[2][2] = 1.0f;
- pout->m[3][3] = 1.0f;
+ D3DX_U(*pout).m[0][1] = 0.0f;
+ D3DX_U(*pout).m[0][2] = 0.0f;
+ D3DX_U(*pout).m[0][3] = 0.0f;
+ D3DX_U(*pout).m[1][0] = 0.0f;
+ D3DX_U(*pout).m[1][2] = 0.0f;
+ D3DX_U(*pout).m[1][3] = 0.0f;
+ D3DX_U(*pout).m[2][0] = 0.0f;
+ D3DX_U(*pout).m[2][1] = 0.0f;
+ D3DX_U(*pout).m[2][3] = 0.0f;
+ D3DX_U(*pout).m[3][0] = 0.0f;
+ D3DX_U(*pout).m[3][1] = 0.0f;
+ D3DX_U(*pout).m[3][2] = 0.0f;
+ D3DX_U(*pout).m[0][0] = 1.0f;
+ D3DX_U(*pout).m[1][1] = 1.0f;
+ D3DX_U(*pout).m[2][2] = 1.0f;
+ D3DX_U(*pout).m[3][3] = 1.0f;
return pout;
}
@@ -354,11 +359,12 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
{
for (j=0; j<4; j++)
{
- if ( fabs(pm->m[i][j] - testmatrix.m[i][j]) > 0.0001 ) equal = FALSE;
+ if ( fabs(D3DX_U(*pm).m[i][j] - D3DX_U(testmatrix).m[i][j]) > 0.0001 ) equal = FALSE;
}
}
return equal;
}
+#undef D3DX_U
/*__________________D3DXPLANE____________________*/
More information about the wine-cvs
mailing list