David Adam : d3dx8: Implement D3DX8Vec2LengthSq with a test.

Alexandre Julliard julliard at winehq.org
Tue Oct 16 07:59:55 CDT 2007


Module: wine
Branch: master
Commit: d404ec8c4b77499c8276858ae24044996109f071
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d404ec8c4b77499c8276858ae24044996109f071

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Sun Oct 14 01:15:30 2007 +0200

d3dx8: Implement D3DX8Vec2LengthSq with a test.

---

 dlls/d3dx8/tests/math.c |   12 ++++++++++++
 include/d3dx8math.h     |    1 +
 include/d3dx8math.inl   |    6 ++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index e9afd60..a8d80a3 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -39,7 +39,19 @@ static void D3X8Vector2Test(void)
     expected=0.0f;
     got= D3DXVec2Length(NULL);
     ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
+
+
+/*_______________D3DXVec2LengthSq________________________*/
+   expected = 25.0f;
+   got = D3DXVec2LengthSq(&u);
+   ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
+   /* Tests the case NULL */
+    expected=0.0f;
+    got= D3DXVec2LengthSq(NULL);
+    ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
+
 }
+
 START_TEST(math)
 {
     D3X8Vector2Test();
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index aa561ed..2a98e00 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -59,5 +59,6 @@ typedef struct D3DXCOLOR
 } D3DXCOLOR, *LPD3DXCOLOR;
 
 FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv);
+FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv);
 
 #endif /* __D3DX8MATH_H__ */
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index e9b1b6d..e5ced8d 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -25,4 +25,10 @@ extern inline FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv)
     return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
 }
 
+extern inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
+{
+    if (!pv) return 0.0f;
+    return( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
+}
+
 #endif




More information about the wine-cvs mailing list