Changeset d3ca210 in mainline for softfloat/generic/common.c


Ignore:
Timestamp:
2006-02-13T20:09:55Z (20 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1f95f2
Parents:
e979fea
Message:

Fixed most problems with 64bit arithmetic (but division is still buggy).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • softfloat/generic/common.c

    re979fea rd3ca210  
    4848        };
    4949       
    50         cfrac >>= 1;
     50        cfrac += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3));
     51       
     52        if ((cexp < 0) || ( cexp == 0 && (!(cfrac & (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1)))))) {
     53                /* FIXME: underflow */
     54                result.parts.exp = 0;
     55                if ((cexp + FLOAT64_FRACTION_SIZE) < 0) {
     56                        result.parts.fraction = 0;
     57                        return result;
     58                }
     59                //cfrac >>= 1;
     60                while (cexp < 0) {
     61                        cexp++;
     62                        cfrac >>= 1;
     63                }
     64                       
     65                result.parts.fraction = ((cfrac >>(64 - FLOAT64_FRACTION_SIZE - 2) ) & (~FLOAT64_HIDDEN_BIT_MASK));
     66
     67                return result;
     68        }
     69       
    5170        ++cexp;
    52         cfrac += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3));
    5371
    5472        if (cfrac & (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1 ))) {
    5573                ++cexp;
    5674                cfrac >>= 1;
    57                 }       
     75        }       
    5876
    5977        /* check overflow */
     
    6583        }
    6684
    67         if (cexp < 0) {
    68                 /* FIXME: underflow */
    69                 result.parts.exp = 0;
    70                 if ((cexp + FLOAT64_FRACTION_SIZE) < 0) {
    71                         result.parts.fraction = 0;
    72                         return result;
    73                 }
    74                 cfrac >>= 1;
    75                 while (cexp < 0) {
    76                         cexp ++;
    77                         cfrac >>= 1;
    78                 }
    79                 return result;
    80                
    81         } else {
    82                 cexp ++; /*normalized*/
    83                 result.parts.exp = (__u32)cexp;
    84         }
     85        result.parts.exp = (__u32)cexp;
    8586       
    8687        result.parts.fraction = ((cfrac >>(64 - FLOAT64_FRACTION_SIZE - 2 ) ) & (~FLOAT64_HIDDEN_BIT_MASK));
     
    8889        return result; 
    8990}
     91
Note: See TracChangeset for help on using the changeset viewer.