[Piglit] [PATCH 3/4] util: Fix an -Wabsolute-value warning
Chad Versace
chad.versace at linux.intel.com
Wed Jul 9 14:47:51 PDT 2014
To fix the warning below, replace fabs with abs.
tests/util/piglit-util-gl-common.c:1240:9: warning: using floating point
absolute value function 'fabs' when argument is of integer type
[-Wabsolute-value] \
if (fabs(probe[p] - expected[p]) >= piglit_tolerance[p]) {
^
tests/util/piglit-util-gl-common.c:1240:9: note: use function 'abs' instead
if (fabs(probe[p] - expected[p]) >= piglit_tolerance[p]) {
^~~~
abs
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/util/piglit-util-gl-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c
index cadf714..41fb245 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -1237,7 +1237,7 @@ piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int *expected)
probe = &pixels[(j*w+i)*4];
for (p = 0; p < 4; ++p) {
- if (fabs(probe[p] - expected[p]) >= piglit_tolerance[p]) {
+ if (abs(probe[p] - expected[p]) >= piglit_tolerance[p]) {
printf("Probe color at (%d,%d)\n", x+i, y+j);
printf(" Expected: %d %d %d %d\n",
expected[0], expected[1], expected[2], expected[3]);
--
2.0.0
More information about the Piglit
mailing list