xref: /dflybsd-src/contrib/gcc-4.7/libgcc/floatunsixf.c (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Public domain.  */
2*e4b17023SJohn Marino typedef int SItype __attribute__ ((mode (SI)));
3*e4b17023SJohn Marino typedef unsigned int USItype __attribute__ ((mode (SI)));
4*e4b17023SJohn Marino typedef float XFtype __attribute__ ((mode (XF)));
5*e4b17023SJohn Marino 
6*e4b17023SJohn Marino XFtype
__floatunsixf(USItype u)7*e4b17023SJohn Marino __floatunsixf (USItype u)
8*e4b17023SJohn Marino {
9*e4b17023SJohn Marino   SItype s = (SItype) u;
10*e4b17023SJohn Marino   XFtype r = (XFtype) s;
11*e4b17023SJohn Marino   if (s < 0)
12*e4b17023SJohn Marino     r += (XFtype)2.0 * (XFtype) ((USItype) 1
13*e4b17023SJohn Marino 				 << (sizeof (USItype) * __CHAR_BIT__ - 1));
14*e4b17023SJohn Marino   return r;
15*e4b17023SJohn Marino }
16