Changes in uspace/lib/softfloat/common.c [7462674:2416085] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softfloat/common.c
r7462674 r2416085 39 39 /* Table for fast leading zeroes counting. */ 40 40 char zeroTable[256] = { 41 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, \41 8, 7, 7, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, \ 42 42 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, \ 43 43 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \ … … 307 307 /** 308 308 * Round and normalize number expressed by exponent and fraction with 309 * first bit (equal to hidden bit) at bit 62.309 * first bit (equal to hidden bit) at 62nd bit. 310 310 * 311 311 * @param exp Exponent part. 312 * @param fraction Fraction with hidden bit shifted to bit 62.312 * @param fraction Fraction with hidden bit shifted to 62nd bit. 313 313 */ 314 314 void round_float64(int32_t *exp, uint64_t *fraction) 315 315 { 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 */ 316 /* rounding - if first bit after fraction is set then round up */ 324 317 (*fraction) += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3)); 325 318 326 /* See if there was a carry to bit 63. */327 319 if ((*fraction) & 328 (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1))) {320 (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 3))) { 329 321 /* rounding overflow */ 330 322 ++(*exp);
Note:
See TracChangeset
for help on using the changeset viewer.