From 5cd8d2b93fad2011fdf8f49a263d77697af35b32 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 11 Jul 2018 01:16:28 -0700 Subject: Upgrade to SoftFloat 3e --- softfloat/i64_to_f32.c | 108 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 38 deletions(-) mode change 100755 => 100644 softfloat/i64_to_f32.c (limited to 'softfloat/i64_to_f32.c') diff --git a/softfloat/i64_to_f32.c b/softfloat/i64_to_f32.c old mode 100755 new mode 100644 index 6b2d2b8..391e1ae --- a/softfloat/i64_to_f32.c +++ b/softfloat/i64_to_f32.c @@ -1,38 +1,70 @@ -// See LICENSE.SoftFloat for license details. - - -#include -#include -#include "platform.h" -#include "primitives.h" -#include "internals.h" -#include "softfloat.h" - -float32_t i64_to_f32( int_fast64_t a ) -{ - bool sign; - uint_fast64_t absA; - int shiftCount; - union ui32_f32 u; - uint_fast32_t sig; - - sign = ( a < 0 ); - absA = sign ? - (uint_fast64_t) a : a; - shiftCount = softfloat_countLeadingZeros64( absA ) - 40; - if ( 0 <= shiftCount ) { - u.ui = - a ? packToF32UI( - sign, 0x95 - shiftCount, (uint_fast32_t) absA< +#include +#include "platform.h" +#include "internals.h" +#include "softfloat.h" + +float32_t i64_to_f32( int64_t a ) +{ + bool sign; + uint_fast64_t absA; + int_fast8_t shiftDist; + union ui32_f32 u; + uint_fast32_t sig; + + sign = (a < 0); + absA = sign ? -(uint_fast64_t) a : (uint_fast64_t) a; + shiftDist = softfloat_countLeadingZeros64( absA ) - 40; + if ( 0 <= shiftDist ) { + u.ui = + a ? packToF32UI( + sign, 0x95 - shiftDist, (uint_fast32_t) absA<