[Mesa-dev] [PATCH kmscube] texturator: Use !! for boolean assignment

Fabio Estevam festevam at gmail.com
Tue Mar 31 19:25:04 UTC 2020


The 'complemented' variable is a pointer to boolean. Use the !! operator
to fix the following build warning:

../texturator.c:603:45: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
  *complemented = (((float)rgba[2]) / 255.0) / 0.25;

Signed-off-by: Fabio Estevam <festevam at gmail.com>
---
 texturator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/texturator.c b/texturator.c
index a450dfe..d31b601 100644
--- a/texturator.c
+++ b/texturator.c
@@ -602,7 +602,7 @@ static void extract_pix(uint8_t *rgba, int *slice, int *level, bool *complemente
 {
 	*slice = (((float)rgba[0]) / 255.0) * 8.0;
 	*level = (((float)rgba[1]) / 255.0) * 16.0;
-	*complemented = (((float)rgba[2]) / 255.0) / 0.25;
+	*complemented = !!(((float)rgba[2]) / 255.0) / 0.25;
 }
 
 static bool probe_pix(int x, int y, int w, int h, int s, int m)
-- 
2.17.1



More information about the mesa-dev mailing list