tests: Use compare_uint() in compare_float().

Comparing the result of abs() is broken in the case that x - y == INT_MIN.
This commit is contained in:
Zebediah Figura
2023-06-23 15:36:26 -05:00
committed by Alexandre Julliard
parent bdfec4886d
commit 69ecfdfb0b
Notes: Alexandre Julliard 2023-06-27 23:35:17 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/247
2 changed files with 8 additions and 11 deletions

View File

@@ -74,13 +74,6 @@ static void set_viewport(D3D12_VIEWPORT *vp, float x, float y,
vp->MaxDepth = max_depth;
}
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)
{
return compare_uint(c1 & 0xff, c2 & 0xff, max_diff)