Mesa (master): mesa: Avoid aliasing violation in FXT1.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Jul 26 19:12:39 UTC 2016


Module: Mesa
Branch: master
Commit: f5ac1d366e81ee9ad11f44ee64a5b556bc6f1989
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5ac1d366e81ee9ad11f44ee64a5b556bc6f1989

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu May 26 15:53:30 2016 -0700

mesa: Avoid aliasing violation in FXT1.

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/texcompress_fxt1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c
index ae339e1..c5646fb 100644
--- a/src/mesa/main/texcompress_fxt1.c
+++ b/src/mesa/main/texcompress_fxt1.c
@@ -177,8 +177,8 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
 #define LL_RMS_D 10 /* fault tolerance (maximum delta) */
 #define LL_RMS_E 255 /* fault tolerance (maximum error) */
 #define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */
-#define ISTBLACK(v) (*((GLuint *)(v)) == 0)
-
+static const GLuint zero = 0;
+#define ISTBLACK(v) (memcmp(&(v), &zero, sizeof(zero)) == 0)
 
 /*
  * Define a 64-bit unsigned integer type and macros




More information about the mesa-commit mailing list