Changeset 58775d30 in mainline for uspace/lib/softfloat/mul.c
- Timestamp:
- 2015-03-16T16:07:21Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2003739
- Parents:
- 6069061 (diff), 795e2bf (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softfloat/mul.c
r6069061 r58775d30 34 34 */ 35 35 36 #include "sftypes.h"37 36 #include "mul.h" 38 37 #include "comparison.h" … … 62 61 return result; 63 62 } 63 64 64 if (is_float32_signan(b)) { /* TODO: fix SigNaN */ 65 65 result.parts.fraction = b.parts.fraction; … … 67 67 return result; 68 68 } 69 69 70 /* set NaN as result */ 70 71 result.bin = FLOAT32_NAN; … … 78 79 return result; 79 80 } 81 80 82 result.parts.fraction = a.parts.fraction; 81 83 result.parts.exp = a.parts.exp; … … 89 91 return result; 90 92 } 93 91 94 result.parts.fraction = b.parts.fraction; 92 95 result.parts.exp = b.parts.exp; … … 106 109 } 107 110 108 if (exp < 0) { 111 if (exp < 0) { 109 112 /* FIXME: underflow */ 110 113 /* return signed zero */ … … 164 167 /* denormalized number */ 165 168 frac1 >>= 1; /* denormalize */ 169 166 170 while ((frac1 > 0) && (exp < 0)) { 167 171 frac1 >>= 1; 168 172 ++exp; 169 173 } 174 170 175 if (frac1 == 0) { 171 176 /* FIXME : underflow */ … … 175 180 } 176 181 } 182 177 183 result.parts.exp = exp; 178 184 result.parts.fraction = frac1 & ((1 << FLOAT32_FRACTION_SIZE) - 1); … … 380 386 } 381 387 388 #ifdef float32_t 389 390 float32_t __mulsf3(float32_t a, float32_t b) 391 { 392 float32_u ua; 393 ua.val = a; 394 395 float32_u ub; 396 ub.val = b; 397 398 float32_u res; 399 res.data = mul_float32(ua.data, ub.data); 400 401 return res.val; 402 } 403 404 float32_t __aeabi_fmul(float32_t a, float32_t b) 405 { 406 float32_u ua; 407 ua.val = a; 408 409 float32_u ub; 410 ub.val = b; 411 412 float32_u res; 413 res.data = mul_float32(ua.data, ub.data); 414 415 return res.val; 416 } 417 418 #endif 419 420 #ifdef float64_t 421 422 float64_t __muldf3(float64_t a, float64_t b) 423 { 424 float64_u ua; 425 ua.val = a; 426 427 float64_u ub; 428 ub.val = b; 429 430 float64_u res; 431 res.data = mul_float64(ua.data, ub.data); 432 433 return res.val; 434 } 435 436 float64_t __aeabi_dmul(float64_t a, float64_t b) 437 { 438 float64_u ua; 439 ua.val = a; 440 441 float64_u ub; 442 ub.val = b; 443 444 float64_u res; 445 res.data = mul_float64(ua.data, ub.data); 446 447 return res.val; 448 } 449 450 #endif 451 452 #ifdef float128_t 453 454 float128_t __multf3(float128_t a, float128_t b) 455 { 456 float128_u ua; 457 ua.val = a; 458 459 float128_u ub; 460 ub.val = b; 461 462 float128_u res; 463 res.data = mul_float128(ua.data, ub.data); 464 465 return res.val; 466 } 467 468 void _Qp_mul(float128_t *c, float128_t *a, float128_t *b) 469 { 470 *c = __multf3(*a, *b); 471 } 472 473 #endif 474 382 475 /** @} 383 476 */
Note:
See TracChangeset
for help on using the changeset viewer.