floatunsixf.c 384 B

12345678910111213141516
  1. /* Public domain. */
  2. typedef int SItype __attribute__ ((mode (SI)));
  3. typedef unsigned int USItype __attribute__ ((mode (SI)));
  4. typedef float XFtype __attribute__ ((mode (XF)));
  5. XFtype
  6. __floatunsixf (USItype u)
  7. {
  8. SItype s = (SItype) u;
  9. XFtype r = (XFtype) s;
  10. if (s < 0)
  11. r += (XFtype)2.0 * (XFtype) ((USItype) 1
  12. << (sizeof (USItype) * __CHAR_BIT__ - 1));
  13. return r;
  14. }