]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/fixdfdi.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / fixdfdi.c
1 /* Public domain.  */
2 typedef unsigned int USItype __attribute__ ((mode (SI)));
3 typedef int DItype __attribute__ ((mode (DI)));
4 typedef unsigned int UDItype __attribute__ ((mode (DI)));
5 typedef float DFtype __attribute__ ((mode (DF)));
6
7 DItype __fixdfdi (DFtype);
8
9 /* This version is needed to prevent recursion; fixunsdfdi in libgcc
10    calls fixdfdi, which in turn calls calls fixunsdfdi.  */
11
12 static DItype
13 local_fixunsdfdi (DFtype a)
14 {
15   USItype hi, lo;
16
17   hi = a / (((UDItype) 1) << (sizeof (USItype) * 8));
18   lo = a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (USItype) * 8));
19   return ((UDItype) hi << (sizeof (USItype) * 8)) | lo;
20 }
21
22 DItype
23 __fixdfdi (DFtype a)
24 {
25   if (a < 0)
26     return - local_fixunsdfdi (-a);
27   return local_fixunsdfdi (a);
28 }