Merge from mainline
[official-gcc.git] / gcc / config / floatunditf.c
blob1583e2a2e5684c2967a9c04cde6dbc6309c2f0b6
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 __floatunditf (UDItype);
12 TFtype
13 __floatunditf (UDItype u)
15 DFtype dh, dl;
17 dh = (USItype) (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