summaryrefslogtreecommitdiff
path: root/lib/libc/softfloat/bits64/softfloat.c
diff options
context:
space:
mode:
authormatt <matt@NetBSD.org>2011-07-04 08:02:34 +0000
committermatt <matt@NetBSD.org>2011-07-04 08:02:34 +0000
commit65f52d9e3cfca17f9f39fe0f31c7c341acdd23d8 (patch)
tree09a4c9f26545abeede10935972416904e71fa383 /lib/libc/softfloat/bits64/softfloat.c
parent9bfdaef20c6f3e5aacf80a7ca3d20409c43aee47 (diff)
Add __floatunsidf __floatunsisf __floatunsitf routines.
XXX i think they are correct but not sure.
Diffstat (limited to 'lib/libc/softfloat/bits64/softfloat.c')
-rw-r--r--lib/libc/softfloat/bits64/softfloat.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/lib/libc/softfloat/bits64/softfloat.c b/lib/libc/softfloat/bits64/softfloat.c
index b0d2bdf138d..d7c47540395 100644
--- a/lib/libc/softfloat/bits64/softfloat.c
+++ b/lib/libc/softfloat/bits64/softfloat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.5 2007/11/08 21:31:04 martin Exp $ */
+/* $NetBSD: softfloat.c,v 1.6 2011/07/04 08:02:35 matt Exp $ */
/*
* This version hacked for use with gcc -msoft-float by bjh21.
@@ -46,7 +46,7 @@ this code that are retained.
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.5 2007/11/08 21:31:04 martin Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.6 2011/07/04 08:02:35 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef SOFTFLOAT_FOR_GCC
@@ -1128,6 +1128,15 @@ float32 int32_to_float32( int32 a )
}
+float32 uint32_to_float32( uint32 a )
+{
+ if ( a == 0 ) return 0;
+ if ( a & (bits32) 0x80000000 )
+ return normalizeRoundAndPackFloat32( 0, 0x9D, a >> 1 );
+ return normalizeRoundAndPackFloat32( 0, 0x9C, a );
+}
+
+
/*
-------------------------------------------------------------------------------
Returns the result of converting the 32-bit two's complement integer `a'
@@ -1151,6 +1160,17 @@ float64 int32_to_float64( int32 a )
}
+float64 uint32_to_float64( uint32 a )
+{
+ int8 shiftCount;
+ bits64 zSig = a;
+
+ if ( a == 0 ) return 0;
+ shiftCount = countLeadingZeros32( a ) + 21;
+ return packFloat64( 0, 0x432 - shiftCount, zSig<<shiftCount );
+
+}
+
#ifdef FLOATX80
/*
@@ -1177,6 +1197,17 @@ floatx80 int32_to_floatx80( int32 a )
}
+floatx80 uint32_to_floatx80( uint32 a )
+{
+ int8 shiftCount;
+ bits64 zSig = a;
+
+ if ( a == 0 ) return packFloatx80( 0, 0, 0 );
+ shiftCount = countLeadingZeros32( a ) + 32;
+ return packFloatx80( 0, 0x403E - shiftCount, zSig<<shiftCount );
+
+}
+
#endif
#ifdef FLOAT128
@@ -1204,6 +1235,17 @@ float128 int32_to_float128( int32 a )
}
+float128 uint32_to_float128( uint32 a )
+{
+ int8 shiftCount;
+ bits64 zSig0 = a;
+
+ if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
+ shiftCount = countLeadingZeros32( a ) + 17;
+ return packFloat128( 0, 0x402E - shiftCount, zSig0<<shiftCount, 0 );
+
+}
+
#endif
#ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */