[Piglit] [PATCH] ext_packed_depth_stencil: Fix Clang absolute-value warning.

Vinson Lee vlee at freedesktop.org
Tue Mar 3 18:19:48 PST 2015


readpixels-24_8.c:62:6: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
            abs((value >> 8) - (expected >> 8)) > 1) {
            ^
readpixels-24_8.c:62:6: note: remove the call to 'abs' since unsigned values cannot be negative
            abs((value >> 8) - (expected >> 8)) > 1) {
            ^~~

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/spec/ext_packed_depth_stencil/readpixels-24_8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c b/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
index 7fb9ad8..1a3b055 100644
--- a/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
+++ b/tests/spec/ext_packed_depth_stencil/readpixels-24_8.c
@@ -59,7 +59,7 @@ test_pixel(int x, int y, uint32_t value)
 
 	/* Compare depth and stencil separately. Use 1-bit tolerance for depth. */
 	if ((value & 0xff) - (expected & 0xff) != 0 ||
-	    abs((value >> 8) - (expected >> 8)) > 1) {
+	    ((value >> 8) - (expected >> 8)) > 1) {
 		fprintf(stderr,
 			"Expected 0x%08x at (%d,%d), found 0x%08x\n",
 			expected, x, y, value);
-- 
2.3.1



More information about the Piglit mailing list