floatunsidf.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 DFtype __attribute__ ((mode (DF)));
  5. DFtype
  6. __floatunsidf (USItype u)
  7. {
  8. SItype s = (SItype) u;
  9. DFtype r = (DFtype) s;
  10. if (s < 0)
  11. r += (DFtype)2.0 * (DFtype) ((USItype) 1
  12. << (sizeof (USItype) * __CHAR_BIT__ - 1));
  13. return r;
  14. }