Subversion Repositories HelenOS-historic

Rev

Rev 874 | Rev 876 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 874 Rev 875
Line 439... Line 439...
439
}
439
}
440
 
440
 
441
 
441
 
442
float32 uint64_to_float32(__u64 i)
442
float32 uint64_to_float32(__u64 i)
443
{
443
{
-
 
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;
444
}
472
}
445
 
473
 
446
float32 int64_to_float32(__s64 i)
474
float32 int64_to_float32(__s64 i)
447
{
475
{
448
    float32 result;
476
    float32 result;