Changeset 58775d30 in mainline for uspace/lib/softfloat/add.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/add.c
r6069061 r58775d30 34 34 */ 35 35 36 #include "sftypes.h"37 36 #include "add.h" 38 37 #include "comparison.h" 39 38 #include "common.h" 39 #include "sub.h" 40 40 41 41 /** Add two single-precision floats with the same sign. … … 413 413 } 414 414 415 #ifdef float32_t 416 417 float32_t __addsf3(float32_t a, float32_t b) 418 { 419 float32_u ua; 420 ua.val = a; 421 422 float32_u ub; 423 ub.val = b; 424 425 float32_u res; 426 427 if (ua.data.parts.sign != ub.data.parts.sign) { 428 if (ua.data.parts.sign) { 429 ua.data.parts.sign = 0; 430 res.data = sub_float32(ub.data, ua.data); 431 } else { 432 ub.data.parts.sign = 0; 433 res.data = sub_float32(ua.data, ub.data); 434 } 435 } else 436 res.data = add_float32(ua.data, ub.data); 437 438 return res.val; 439 } 440 441 float32_t __aeabi_fadd(float32_t a, float32_t b) 442 { 443 float32_u ua; 444 ua.val = a; 445 446 float32_u ub; 447 ub.val = b; 448 449 float32_u res; 450 451 if (ua.data.parts.sign != ub.data.parts.sign) { 452 if (ua.data.parts.sign) { 453 ua.data.parts.sign = 0; 454 res.data = sub_float32(ub.data, ua.data); 455 } else { 456 ub.data.parts.sign = 0; 457 res.data = sub_float32(ua.data, ub.data); 458 } 459 } else 460 res.data = add_float32(ua.data, ub.data); 461 462 return res.val; 463 } 464 465 #endif 466 467 #ifdef float64_t 468 469 float64_t __adddf3(float64_t a, float64_t b) 470 { 471 float64_u ua; 472 ua.val = a; 473 474 float64_u ub; 475 ub.val = b; 476 477 float64_u res; 478 479 if (ua.data.parts.sign != ub.data.parts.sign) { 480 if (ua.data.parts.sign) { 481 ua.data.parts.sign = 0; 482 res.data = sub_float64(ub.data, ua.data); 483 } else { 484 ub.data.parts.sign = 0; 485 res.data = sub_float64(ua.data, ub.data); 486 } 487 } else 488 res.data = add_float64(ua.data, ub.data); 489 490 return res.val; 491 } 492 493 float64_t __aeabi_dadd(float64_t a, float64_t b) 494 { 495 float64_u ua; 496 ua.val = a; 497 498 float64_u ub; 499 ub.val = b; 500 501 float64_u res; 502 503 if (ua.data.parts.sign != ub.data.parts.sign) { 504 if (ua.data.parts.sign) { 505 ua.data.parts.sign = 0; 506 res.data = sub_float64(ub.data, ua.data); 507 } else { 508 ub.data.parts.sign = 0; 509 res.data = sub_float64(ua.data, ub.data); 510 } 511 } else 512 res.data = add_float64(ua.data, ub.data); 513 514 return res.val; 515 } 516 517 #endif 518 519 #ifdef float128_t 520 521 float128_t __addtf3(float128_t a, float128_t b) 522 { 523 float128_u ua; 524 ua.val = a; 525 526 float128_u ub; 527 ub.val = b; 528 529 float128_u res; 530 531 if (ua.data.parts.sign != ub.data.parts.sign) { 532 if (ua.data.parts.sign) { 533 ua.data.parts.sign = 0; 534 res.data = sub_float128(ub.data, ua.data); 535 } else { 536 ub.data.parts.sign = 0; 537 res.data = sub_float128(ua.data, ub.data); 538 } 539 } else 540 res.data = add_float128(ua.data, ub.data); 541 542 return res.val; 543 } 544 545 void _Qp_add(float128_t *c, float128_t *a, float128_t *b) 546 { 547 *c = __addtf3(*a, *b); 548 } 549 550 #endif 551 415 552 /** @} 416 553 */
Note:
See TracChangeset
for help on using the changeset viewer.