From: Matt Turner Date: Thu, 19 Oct 2017 05:16:05 +0000 (-0700) Subject: i965: Use a union to bitcast a float X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9796ebca7d2977700ff51ade9193e33368bd4af;p=mesa.git i965: Use a union to bitcast a float ... which does not break C's aliasing rules. --- 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