[v2] select: Fix Clang absolute-value warnings.

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

Details

Message ID 1427602547-17743-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.
select.c:126:10: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
        diffz = abs(hit1[MIN_Z] - hit2[MIN_Z])/zscale;
                ^
select.c:126:10: note: remove the call to 'abs' since unsigned values cannot be negative
        diffz = abs(hit1[MIN_Z] - hit2[MIN_Z])/zscale;
                ^~~
select.c:138:10: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
        diffz = abs(hit1[MAX_Z] - hit2[MAX_Z])/zscale;
                ^
select.c:138:10: note: remove the call to 'abs' since unsigned values cannot be negative
        diffz = abs(hit1[MAX_Z] - hit2[MAX_Z])/zscale;
                ^~~

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 tests/general/select.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/general/select.c b/tests/general/select.c
index 879a1e9..aadf2ef 100644
--- a/tests/general/select.c
+++ b/tests/general/select.c
@@ -123,7 +123,7 @@  compare_hit_record(GLuint* hit1, GLuint* hit2)
 		return false;
 	}
 
-	diffz = abs(hit1[MIN_Z] - hit2[MIN_Z])/zscale;
+	diffz = abs((GLint) hit1[MIN_Z] - (GLint) hit2[MIN_Z])/zscale;
 	if (diffz > 0.1) {
 		printf("\t%s : Incorrect Minz : %u %u (%f %f) %f\n",
 			__FUNCTION__,
@@ -135,7 +135,7 @@  compare_hit_record(GLuint* hit1, GLuint* hit2)
 		return false;
 	}
 
-	diffz = abs(hit1[MAX_Z] - hit2[MAX_Z])/zscale;
+	diffz = abs((GLint) hit1[MAX_Z] - (GLint) hit2[MAX_Z])/zscale;
 	if (diffz > 0.1) {
 		printf("\t%s : Incorrect Maxz : %u %u (%f %f) %f\n",
 			__FUNCTION__,