Changeset ba5870d in mainline


Ignore:
Timestamp:
2006-02-24T17:55:08Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f37d769
Parents:
1d83419
Message:

Long long → float conversion finished.

Location:
softfloat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • softfloat/generic/conversion.c

    r1d83419 rba5870d  
    442442float32 uint64_to_float32(__u64 i)
    443443{
     444        int counter;
     445        __s32 exp;
     446        float32 result;
     447       
     448        result.parts.sign = 0;
     449        result.parts.fraction = 0;
     450
     451        counter = countZeroes64(i);
     452
     453        exp = FLOAT32_BIAS + 64 - counter - 1;
     454       
     455        if (counter == 64) {
     456                result.binary = 0;
     457                return result;
     458        }
     459       
     460        /* Shift all to the first 31 bits (31. will be hidden 1)*/
     461        if (counter > 33) {
     462                i <<= counter - 1 - 32;
     463        } else {
     464                i >>= 1 + 32 - counter;
     465        }
     466
     467        roundFloat32(&exp, &i);
     468
     469        result.parts.fraction = i >> 7;
     470        result.parts.exp = exp;
     471        return result;
    444472}
    445473
  • softfloat/include/common.h

    r1d83419 rba5870d  
    3434float64 finishFloat64(__s32 cexp, __u64 cfrac, char sign);
    3535
     36int countZeroes64(__u64 i);
    3637int countZeroes32(__u32 i);
    3738int countZeroes8(__u8 i);
Note: See TracChangeset for help on using the changeset viewer.