From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VxzUX-000587-Ch for qemu-devel@nongnu.org; Tue, 31 Dec 2013 08:36:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VxzUV-0000Ul-Pr for qemu-devel@nongnu.org; Tue, 31 Dec 2013 08:36:17 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:44050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VxzUV-0000TO-If for qemu-devel@nongnu.org; Tue, 31 Dec 2013 08:36:15 -0500 From: Peter Maydell Date: Tue, 31 Dec 2013 13:35:39 +0000 Message-Id: <1388496958-3542-4-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1388496958-3542-1-git-send-email-peter.maydell@linaro.org> References: <1388496958-3542-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 03/22] softfloat: Add 16 bit integer to float conversions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Tom Musta , Peter Crosthwaite , patches@linaro.org, Aurelien Jarno , Michael Matz , Alexander Graf , Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvmarm@lists.cs.columbia.edu, Christoffer Dall , Richard Henderson Add the float to 16 bit integer conversion routines. These can be trivially implemented in terms of the int32_to_float* routines, but providing them makes our API more symmetrical and can simplify callers. Signed-off-by: Peter Maydell --- include/fpu/softfloat.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index a9b8cd9..3790b10 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -238,6 +238,23 @@ float64 uint64_to_float64( uint64 STATUS_PARAM ); floatx80 int64_to_floatx80( int64 STATUS_PARAM ); float128 int64_to_float128( int64 STATUS_PARAM ); float128 uint64_to_float128( uint64 STATUS_PARAM ); +/* We provide the int16 versions for symmetry of API with float-to-int */ +INLINE float32 int16_to_float32(int_fast16_t v STATUS_PARAM) +{ + return int32_to_float32(v STATUS_VAR); +} +INLINE float32 uint16_to_float32(uint_fast16_t v STATUS_PARAM) +{ + return uint32_to_float32(v STATUS_VAR); +} +INLINE float64 int16_to_float64(int_fast16_t v STATUS_PARAM) +{ + return int32_to_float64(v STATUS_VAR); +} +INLINE float64 uint16_to_float64(uint_fast16_t v STATUS_PARAM) +{ + return uint32_to_float64(v STATUS_VAR); +} /*---------------------------------------------------------------------------- | Software half-precision conversion routines. -- 1.8.5