Merge from mainline
[official-gcc.git] / gcc / config / floatditf.c
blob9671ac710f13438202e05ec1127237387285a9a1
1 /* Public domain. */
2 #if __LDBL_MANT_DIG__ == 106 || __LDBL_MANT_DIG__ == 113
3 typedef int DItype __attribute__ ((mode (DI)));
4 typedef int SItype __attribute__ ((mode (SI)));
5 typedef unsigned int UDItype __attribute__ ((mode (DI)));
6 typedef unsigned int USItype __attribute__ ((mode (SI)));
7 typedef float DFtype __attribute__ ((mode (DF)));
8 typedef float TFtype __attribute__ ((mode (TF)));
10 TFtype __floatditf (UDItype);
12 TFtype
13 __floatditf (UDItype u)
15 DFtype dh, dl;
17 dh = (SItype) (u >> (sizeof (SItype) * 8));
18 dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
19 dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
21 return (TFtype) dh + (TFtype) dl;
24 #endif