]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/fixsfdi.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / fixsfdi.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 SFtype __attribute__ ((mode (SF)));
6 typedef float DFtype __attribute__ ((mode (DF)));
7
8 DItype __fixsfdi (SFtype);
9
10 /* This version is needed to prevent recursion; fixunssfdi in libgcc
11    calls fixsfdi, which in turn calls calls fixunssfdi.  */
12
13 static DItype
14 local_fixunssfdi (SFtype original_a)
15 {
16   DFtype a = original_a;
17   USItype hi, lo;
18
19   hi = a / (((UDItype) 1) << (sizeof (USItype) * 8));
20   lo = a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (USItype) * 8));
21   return ((UDItype) hi << (sizeof (USItype) * 8)) | lo;
22 }
23
24 DItype
25 __fixsfdi (SFtype a)
26 {
27   if (a < 0)
28     return - local_fixunssfdi (-a);
29   return local_fixunssfdi (a);
30 }