Andrew Talbot : d3dx9_36: Eliminate comparisons of unsigned values about zero.

Alexandre Julliard julliard at winehq.org
Mon Sep 12 11:42:56 CDT 2011


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

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Fri Sep  9 22:12:43 2011 +0100

d3dx9_36: Eliminate comparisons of unsigned values about zero.

---

 dlls/d3dx9_36/mesh.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index c6317c8..760931c 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -638,7 +638,7 @@ static HRESULT propagate_face_vertices(CONST DWORD *adjacency, DWORD *point_reps
     {
         DWORD adj_face = adjacency[face_base + edge];
         DWORD adj_face_base;
-        DWORD i,j;
+        DWORD i;
         if (adj_face == -1) /* No adjacent face. */
             continue;
         else if (adj_face >= numfaces)
@@ -659,9 +659,9 @@ static HRESULT propagate_face_vertices(CONST DWORD *adjacency, DWORD *point_reps
         }
 
         /* Replaces vertices in opposite edge with vertices from current edge. */
-        for (i = 0, j = 1; i < 2 && (j+1) > 0; i++, j--)
+        for (i = 0; i < 2; i++)
         {
-            DWORD from = face_base + (edge + j) % VERTS_PER_FACE;
+            DWORD from = face_base + (edge + (1 - i)) % VERTS_PER_FACE;
             DWORD to = adj_face_base + (opp_edge + i) % VERTS_PER_FACE;
 
             /* Propagate lowest index. */
@@ -759,9 +759,11 @@ static HRESULT WINAPI ID3DXMeshImpl_ConvertAdjacencyToPointReps(ID3DXMesh *iface
         if (FAILED(hr)) goto cleanup;
     }
     /* Go in opposite direction to catch all face orderings */
-    for (face = This->numfaces - 1; face + 1 > 0; face--)
+    for (face = 0; face < This->numfaces; face++)
     {
-        hr = propagate_face_vertices(adjacency, point_reps, indices, new_indices, face, This->numfaces);
+        hr = propagate_face_vertices(adjacency, point_reps,
+                                     indices, new_indices,
+                                     (This->numfaces - 1) - face, This->numfaces);
         if (FAILED(hr)) goto cleanup;
     }
 




More information about the wine-cvs mailing list