From e9796ebca7d2977700ff51ade9193e33368bd4af Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 18 Oct 2017 22:16:05 -0700 Subject: [PATCH] i965: Use a union to bitcast a float ... which does not break C's aliasing rules. --- src/mesa/drivers/dri/i965/gen6_constant_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c b/src/mesa/drivers/dri/i965/gen6_constant_state.c index 62ad6b04976..121ba672575 100644 --- a/src/mesa/drivers/dri/i965/gen6_constant_state.c +++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c @@ -32,7 +32,8 @@ static uint32_t f_as_u32(float f) { - return *(uint32_t *)&f; + union fi fi = { .f = f }; + return fi.ui; } static uint32_t -- 2.30.2