[v2] ext_packed_depth_stencil: Fix Clang absolute-value warning.

Submitted by Vinson Lee on March 29, 2015, 4:15 a.m.

Details

Message ID 1427602507-16871-1-git-send-email-vlee@freedesktop.org
State New
Headers show

Not browsing as part of any series.

Commit Message

Vinson Lee March 29, 2015, 4:15 a.m.
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@freedesktop.org>
---
 tests/spec/ext_packed_depth_stencil/readpixels-24_8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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..08288ca 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) {
+	    abs((int32_t) (value >> 8) - (int32_t) (expected >> 8)) > 1) {
 		fprintf(stderr,
 			"Expected 0x%08x at (%d,%d), found 0x%08x\n",
 			expected, x, y, value);