https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1697b87434b7bda857c428409875705b24d18694

commit 1697b87434b7bda857c428409875705b24d18694
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:07:32 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:06 2021 +0100

    [WINESYNC] d3dx9/tests: Introduce compare_uint().
    
    Signed-off-by: Henri Verbeet <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60 by Henri Verbeet 
<[email protected]>
---
 modules/rostests/winetests/d3dx9_36/texture.c | 23 +++++++++++------------
 sdk/tools/winesync/d3dx9.cfg                  |  2 +-
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/modules/rostests/winetests/d3dx9_36/texture.c 
b/modules/rostests/winetests/d3dx9_36/texture.c
index 2688559c2c7..bec7ba48279 100644
--- a/modules/rostests/winetests/d3dx9_36/texture.c
+++ b/modules/rostests/winetests/d3dx9_36/texture.c
@@ -146,20 +146,19 @@ static inline void expect_vec4_(unsigned int line, const 
D3DXVECTOR4 *expected,
         got->x, got->y, got->z, got->w);
 }
 
+static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
+{
+    unsigned int diff = x > y ? x - y : y - x;
+
+    return diff <= max_diff;
+}
+
 static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff)
 {
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
-        return FALSE;
-    c1 >>= 8; c2 >>= 8;
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
-        return FALSE;
-    c1 >>= 8; c2 >>= 8;
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
-        return FALSE;
-    c1 >>= 8; c2 >>= 8;
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
-        return FALSE;
-    return TRUE;
+    return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)
+            && compare_uint((c1 >> 8) & 0xff, (c2 >> 8) & 0xff, max_diff)
+            && compare_uint((c1 >> 16) & 0xff, (c2 >> 16) & 0xff, max_diff)
+            && compare_uint((c1 >> 24) & 0xff, (c2 >> 24) & 0xff, max_diff);
 }
 
 static BOOL is_autogenmipmap_supported(IDirect3DDevice9 *device, 
D3DRESOURCETYPE resource_type)
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 38b733ba03d..30c69c92f33 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, 
include/d3dx9anim.h: sdk/inc
   include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: 
sdk/include/dxsdk/d3dx9of.h,
   include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, 
include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: 
sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: aab980a16253ff6bb6286572576899bfc0f83945}
+tags: {wine: 9bcb1f5195d1e65e0e7afb288d36fee716fe3a60}

Reply via email to