Received: from [140.186.70.92] (port=34348 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqReD-00030t-IT for qemu-devel@nongnu.org; Fri, 18 Feb 2011 09:49:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqReB-0004ON-Bj for qemu-devel@nongnu.org; Fri, 18 Feb 2011 09:49:29 -0500 Received: from eu1sys200aog114.obsmtp.com ([207.126.144.137]:49147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqReB-0004Nl-0f for qemu-devel@nongnu.org; Fri, 18 Feb 2011 09:49:27 -0500 Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 82368130 for ; Fri, 18 Feb 2011 14:49:24 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas6.st.com [10.75.90.73]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 626362BC2 for ; Fri, 18 Feb 2011 14:49:24 +0000 (GMT) From: Christophe Lyon Date: Fri, 18 Feb 2011 15:49:15 +0100 Message-ID: <1298040557-6342-3-git-send-email-christophe.lyon@st.com> In-Reply-To: <1298040557-6342-1-git-send-email-christophe.lyon@st.com> References: <1298040557-6342-1-git-send-email-christophe.lyon@st.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 2/4] softfloat: add float32_set_sign(), float32_infinity, float64_half, float64_256 and float64_512. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org These constants and utility function are needed to implement some helpers. Defining constants avoids the need to re-compute them at runtime. Signed-off-by: Christophe Lyon --- fpu/softfloat.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fpu/softfloat.h b/fpu/softfloat.h index f34a938..9bd4a50 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -379,9 +379,15 @@ INLINE int float32_is_zero_or_denormal(float32 a) return (float32_val(a) & 0x7f800000) == 0; } +INLINE float32 float32_set_sign(float32 a, int sign) +{ + return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31)); +} + #define float32_zero make_float32(0) #define float32_one make_float32(0x3f800000) #define float32_ln2 make_float32(0x3f317218) +#define float32_infinity make_float32(0x7f800000) /*---------------------------------------------------------------------------- @@ -482,6 +488,9 @@ INLINE int float64_is_any_nan(float64 a) #define float64_zero make_float64(0) #define float64_one make_float64(0x3ff0000000000000LL) #define float64_ln2 make_float64(0x3fe62e42fefa39efLL) +#define float64_half make_float64(0x3fe0000000000000LL) +#define float64_256 make_float64(0x4070000000000000LL) +#define float64_512 make_float64(0x4080000000000000LL) /*---------------------------------------------------------------------------- | The pattern for a default generated double-precision NaN. -- 1.7.2.3