fixunsdfsi.c revision 303975
1207753Smm/* Public domain.  */
2207753Smmtypedef unsigned int USItype __attribute__ ((mode (SI)));
3207753Smmtypedef int SItype __attribute__ ((mode (SI)));
4207753Smmtypedef float SFtype __attribute__ ((mode (SF)));
5207753Smmtypedef float DFtype __attribute__ ((mode (DF)));
6207753Smm
7207753SmmUSItype __fixunsdfsi (DFtype);
8207753Smm
9207753Smm#define SItype_MIN \
10207753Smm  (- ((SItype) (((USItype) 1 << ((sizeof (SItype) * 8) - 1)) - 1)) - 1)
11207753Smm
12207753SmmUSItype
13207753Smm__fixunsdfsi (DFtype a)
14207753Smm{
15207753Smm  if (a >= - (DFtype) SItype_MIN)
16207753Smm    return (SItype) (a + SItype_MIN) - SItype_MIN;
17207753Smm  return (SItype) a;
18207753Smm}
19207753Smm