Commit 162a8e12 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

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.
parent 22fcf28f
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment