Changeset a35b458 in mainline for uspace/lib/softfloat/common.c
- Timestamp:
- 2018-03-02T20:10:49Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softfloat/common.c
r3061bc1 ra35b458 78 78 /* TODO: fix underflow */ 79 79 } 80 80 81 81 if ((cexp < 0) || (cexp == 0 && 82 82 (!(cfrac & (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1)))))) { … … 87 87 return result; 88 88 } 89 89 90 90 while (cexp < 0) { 91 91 cexp++; 92 92 cfrac >>= 1; 93 93 } 94 94 95 95 cfrac += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3)); 96 96 97 97 if (!(cfrac & (FLOAT64_HIDDEN_BIT_MASK << (64 - FLOAT64_FRACTION_SIZE - 1)))) { 98 98 result.parts.fraction = … … 103 103 cfrac += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3)); 104 104 } 105 105 106 106 ++cexp; 107 107 … … 120 120 121 121 result.parts.exp = (uint32_t) cexp; 122 122 123 123 result.parts.fraction = 124 124 ((cfrac >> (64 - FLOAT64_FRACTION_SIZE - 2)) & (~FLOAT64_HIDDEN_BIT_MASK)); 125 125 126 126 return result; 127 127 } … … 289 289 /* rounding - if first bit after fraction is set then round up */ 290 290 (*fraction) += (0x1 << (32 - FLOAT32_FRACTION_SIZE - 3)); 291 291 292 292 if ((*fraction) & 293 293 (FLOAT32_HIDDEN_BIT_MASK << (32 - FLOAT32_FRACTION_SIZE - 1))) { … … 296 296 (*fraction) >>= 1; 297 297 } 298 298 299 299 if (((*exp) >= FLOAT32_MAX_EXPONENT) || ((*exp) < 0)) { 300 300 /* overflow - set infinity as result */ … … 322 322 */ 323 323 (*fraction) += (0x1 << (64 - FLOAT64_FRACTION_SIZE - 3)); 324 324 325 325 /* See if there was a carry to bit 63. */ 326 326 if ((*fraction) & … … 330 330 (*fraction) >>= 1; 331 331 } 332 332 333 333 if (((*exp) >= FLOAT64_MAX_EXPONENT) || ((*exp) < 0)) { 334 334 /* overflow - set infinity as result */ … … 677 677 mul64(b, result, &tmp_hi, &tmp_lo); 678 678 sub128(a_hi, a_lo, tmp_hi, tmp_lo, &rem_hi, &rem_lo); 679 679 680 680 while ((int64_t) rem_hi < 0) { 681 681 result -= 0x1ll << 32;
Note:
See TracChangeset
for help on using the changeset viewer.