diff options
Diffstat (limited to 'contrib/gcc/config/floatdidf.c')
-rw-r--r-- | contrib/gcc/config/floatdidf.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/gcc/config/floatdidf.c b/contrib/gcc/config/floatdidf.c new file mode 100644 index 0000000..45bd0fd --- /dev/null +++ b/contrib/gcc/config/floatdidf.c @@ -0,0 +1,17 @@ +/* Public domain. */ +typedef int SItype __attribute__ ((mode (SI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef float DFtype __attribute__ ((mode (DF))); + +DFtype __floatdidf (DItype); + +DFtype +__floatdidf (DItype u) +{ + /* When the word size is small, we never get any rounding error. */ + DFtype f = (SItype) (u >> (sizeof (SItype) * 8)); + f *= 0x1p32f; + f += (USItype) u; + return f; +} |