floatunsitf.c 384 B

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