Module: wine Branch: master Commit: 162a8e1217c860f4790cdddfc19f3e6000d0c043 URL: https://gitlab.winehq.org/wine/wine/-/commit/162a8e1217c860f4790cdddfc19f3e6...
Author: Jeff Smith whydoubt@gmail.com Date: Wed Aug 2 22:47:38 2023 -0500
d3d10core/tests: Use compare_uint() in compare_float() instead of abs().
The result of abs(INT_MIN) is INT_MIN, which breaks the ulps comparison.
---
dlls/d3d10core/tests/d3d10core.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 31901ad333d..0c6c46ddaf4 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -182,6 +182,13 @@ static HRESULT check_interface_(unsigned int line, void *iface, REFIID riid, BOO return hr; }
+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_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; @@ -192,10 +199,7 @@ static BOOL compare_float(float f, float g, unsigned int ulps) if (y < 0) y = INT_MIN - y;
- if (abs(x - y) > ulps) - return FALSE; - - return TRUE; + return compare_uint(x, y, ulps); }
static BOOL compare_vec4(const struct vec4 *v1, const struct vec4 *v2, unsigned int ulps) @@ -206,13 +210,6 @@ static BOOL compare_vec4(const struct vec4 *v1, const struct vec4 *v2, unsigned && compare_float(v1->w, v2->w, ulps); }
-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_uvec4(const struct uvec4* v1, const struct uvec4 *v2) { return v1->x == v2->x && v1->y == v2->y && v1->z == v2->z && v1->w == v2->w;