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