Changeset 25eec4e in mainline for uspace/lib/softfloat/common.c


Ignore:
Timestamp:
2013-04-19T18:38:18Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6d717a4
Parents:
a1e2df13 (diff), 289cb7dd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline chages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/softfloat/common.c

    ra1e2df13 r25eec4e  
    3939/* Table for fast leading zeroes counting. */
    4040char zeroTable[256] = {
    41         8, 7, 7, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, \
     41        8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, \
    4242        3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \
    4343        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \
     
    307307/**
    308308 * Round and normalize number expressed by exponent and fraction with
    309  * first bit (equal to hidden bit) at 62nd bit.
     309 * first bit (equal to hidden bit) at bit 62.
    310310 *
    311311 * @param exp Exponent part.
    312  * @param fraction Fraction with hidden bit shifted to 62nd bit.
     312 * @param fraction Fraction with hidden bit shifted to bit 62.
    313313 */
    314314void round_float64(int32_t *exp, uint64_t *fraction)
    315315{
    316         /* rounding - if first bit after fraction is set then round up */
     316        /*
     317         * Rounding - if first bit after fraction is set then round up.
     318         */
     319
     320        /*
     321         * Add 1 to the least significant bit of the fraction respecting the
     322         * current shift to bit 62 and see if there will be a carry to bit 63.
     323         */
    317324        (*fraction) += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3));
    318325       
     326        /* See if there was a carry to bit 63. */
    319327        if ((*fraction) &
    320             (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 3))) {
     328            (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1))) {
    321329                /* rounding overflow */
    322330                ++(*exp);
Note: See TracChangeset for help on using the changeset viewer.