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