From 0820b0511a448c5366a747f50d4511de1e54ccb4 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Wed, 23 Nov 2005 03:53:45 +0000 Subject: [PATCH] Do float-to-bit-image conversion in a way which does not break ANSI C aliasing rules. git-svn-id: svn://svn.valgrind.org/vex/trunk@1467 --- VEX/priv/guest-ppc32/toIR.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/VEX/priv/guest-ppc32/toIR.c b/VEX/priv/guest-ppc32/toIR.c index 874424cae2..f601f7c54e 100644 --- a/VEX/priv/guest-ppc32/toIR.c +++ b/VEX/priv/guest-ppc32/toIR.c @@ -303,6 +303,18 @@ typedef enum { static void put_emwarn ( IRExpr* e /* :: Ity_I32 */ ); +/* Produce the 32-bit pattern corresponding to the supplied + float. */ +static UInt float_to_bits ( Float f ) +{ + union { UInt i; Float f; } u; + vassert(4 == sizeof(UInt)); + vassert(4 == sizeof(Float)); + vassert(4 == sizeof(u)); + u.f = f; + return u.i; +} + /*------------------------------------------------------------*/ /*--- Misc Helpers ---*/ @@ -6830,9 +6842,9 @@ static Bool dis_av_fp_convert ( UInt theInstr ) /* scale = 2^UIMM, cast to float, reinterpreted as uint */ scale = (float)( (unsigned int) 1<