From 054e3324b060f8cac04b110d91665a12106eed5e Mon Sep 17 00:00:00 2001 From: "kjh-5727%comcast.net" Date: Mon, 13 Nov 2006 14:42:33 +0000 Subject: [PATCH] Bug 351229 - Avoid a type-punned pointer warning. r+sr=roc. --- gfx/public/nsCoord.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gfx/public/nsCoord.h b/gfx/public/nsCoord.h index ae0cb6c34043..e90259a811f1 100644 --- a/gfx/public/nsCoord.h +++ b/gfx/public/nsCoord.h @@ -61,14 +61,15 @@ //#define NS_COORD_IS_FLOAT inline float NS_IEEEPositiveInfinity() { - float f; - *(PRUint32*)&f = 0x7F800000; - return f; + union { PRUint32 mPRUint32; float mFloat; } pun; + pun.mPRUint32 = 0x7F800000; + return pun.mFloat; } inline PRBool NS_IEEEIsNan(float aF) { - PRUint32 bits = *(PRUint32*)&aF; - return (bits & 0x7F800000) == 0x7F800000 && - (bits & 0x007FFFFF) != 0; + union { PRUint32 mBits; float mFloat; } pun; + pun.mFloat = aF; + return (pun.mBits & 0x7F800000) == 0x7F800000 && + (pun.mBits & 0x007FFFFF) != 0; } #ifdef NS_COORD_IS_FLOAT