[Mesa-dev] [PATCH 3/7] r300g: Avoid aliasing violation.
Marek Olšák
maraeo at gmail.com
Fri Jul 29 20:05:43 UTC 2016
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Fri, Jul 29, 2016 at 12:35 AM, Matt Turner <mattst88 at gmail.com> wrote:
> ---
> src/gallium/drivers/r300/compiler/radeon_inline_literals.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/r300/compiler/radeon_inline_literals.c b/src/gallium/drivers/r300/compiler/radeon_inline_literals.c
> index 492f00e..c40a380 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;
> --
> 2.7.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list