summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2016-07-28 13:57:06 -0700
committerMatt Turner <[email protected]>2016-08-01 12:09:17 -0700
commitd2838f77ec9149149a2c87f8bd547239e1560a70 (patch)
treeb89f1ba770b91d03e2b1c7403b3a201376b3db93 /src/gallium/drivers/r300
parent16ff8f9ae8d4b9cbf69f28384692a9019fc706b4 (diff)
r300g: Avoid aliasing violation.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/compiler/radeon_inline_literals.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/compiler/radeon_inline_literals.c b/src/gallium/drivers/r300/compiler/radeon_inline_literals.c
index 492f00eea5f..c40a3807de4 100644
--- a/src/gallium/drivers/r300/compiler/radeon_inline_literals.c
+++ b/src/gallium/drivers/r300/compiler/radeon_inline_literals.c
@@ -28,6 +28,7 @@
#include "radeon_dataflow.h"
#include "radeon_program.h"
#include "radeon_program_constants.h"
+#include "util/u_bitcast.h"
#include <stdio.h>
#define VERBOSE 0
@@ -45,7 +46,7 @@
*/
static int ieee_754_to_r300_float(float f, unsigned char *r300_float_out)
{
- unsigned float_bits = *((unsigned *)&f);
+ unsigned float_bits = u_bitcast_f2u(f);
/* XXX: Handle big-endian */
unsigned mantissa = float_bits & 0x007fffff;
unsigned biased_exponent = (float_bits & 0x7f800000) >> 23;