diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 1996-10-23 02:45:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 1996-10-23 02:45:07 +0000 |
commit | 34d6007ae0d0bc36beaef2da55c9324adacbc476 (patch) | |
tree | 96985767cf4ff073660604ee9f572547e8a83ab4 /gcc | |
parent | d1b9c52c2f9ac1fd43e44a42c179ad503d281cce (diff) | |
download | gcc-34d6007ae0d0bc36beaef2da55c9324adacbc476.zip gcc-34d6007ae0d0bc36beaef2da55c9324adacbc476.tar.gz gcc-34d6007ae0d0bc36beaef2da55c9324adacbc476.tar.bz2 |
Fix minor bugs in float_to_usi and dp_to_sf
From-SVN: r13000
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/fp-bit.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/config/fp-bit.c b/gcc/config/fp-bit.c index 7381ae8..b8bf9cd 100644 --- a/gcc/config/fp-bit.c +++ b/gcc/config/fp-bit.c @@ -1313,7 +1313,7 @@ float_to_usi (FLO_type arg_a) if (a.normal_exp > 31) return MAX_USI_INT; else if (a.normal_exp > (FRACBITS + NGARDS)) - return a.fraction.ll << ((FRACBITS + NGARDS) - a.normal_exp); + return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS)); else return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp); } @@ -1388,10 +1388,18 @@ SFtype df_to_sf (DFtype arg_a) { fp_number_type in; + USItype sffrac; unpack_d ((FLO_union_type *) & arg_a, &in); - return __make_fp (in.class, in.sign, in.normal_exp, - in.fraction.ll >> F_D_BITOFF); + + sffrac = in.fraction.ll >> F_D_BITOFF; + + /* We set the lowest guard bit in SFFRAC if we discarded any non + zero bits. */ + if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0) + sffrac |= 1; + + return __make_fp (in.class, in.sign, in.normal_exp, sffrac); } #endif |