[PATCH] d3d8: Remove abs() invocations on unsigned integers in color_match

Gerald Pfeifer gerald at ref11-i386.freebsd.org
Tue Nov 6 18:11:22 CST 2018


This is per our discussion - since we're only dealing with unsigned
integers here (and no casts to signed), abs() is a noop.

Gerald
---
 dlls/d3d8/tests/visual.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index e8e6bf870e..0b2ce20787 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -52,13 +52,13 @@ static HWND create_window(void)
 
 static BOOL color_match(D3DCOLOR c1, D3DCOLOR c2, BYTE max_diff)
 {
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    if ((c1 & 0xff) - (c2 & 0xff) > max_diff) return FALSE;
     c1 >>= 8; c2 >>= 8;
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    if ((c1 & 0xff) - (c2 & 0xff) > max_diff) return FALSE;
     c1 >>= 8; c2 >>= 8;
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    if ((c1 & 0xff) - (c2 & 0xff) > max_diff) return FALSE;
     c1 >>= 8; c2 >>= 8;
-    if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
+    if ((c1 & 0xff) - (c2 & 0xff) > max_diff) return FALSE;
     return TRUE;
 }
 
-- 
2.18.0



More information about the wine-devel mailing list