From: Julian Seward Date: Wed, 23 Nov 2005 03:53:45 +0000 (+0000) Subject: Do float-to-bit-image conversion in a way which does not break ANSI C X-Git-Tag: svn/VALGRIND_3_1_1^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0820b0511a448c5366a747f50d4511de1e54ccb4;p=thirdparty%2Fvalgrind.git 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 --- 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<