| 706 | #endif |
| 707 | |
| 708 | static void decFiniteMultiply(bcdnum *num, uByte *bcdacc, |
| 709 | const decFloat *dfl, const decFloat *dfr) { |
| 710 | uInt bufl[MULOPLEN]; // left coefficient (base-billion) |
| 711 | uInt bufr[MULOPLEN]; // right coefficient (base-billion) |
| 712 | uInt *ui, *uj; // work |
| 713 | uByte *ub; // .. |
| 714 | uInt uiwork; // for macros |
| 715 | |
| 716 | #if DECUSE64 |
| 717 | uLong accl[MULACCLEN]; // lazy accumulator (base-billion+) |
| 718 | uLong *pl; // work -> lazy accumulator |
| 719 | uInt acc[MULACCLEN]; // coefficent in base-billion .. |
| 720 | #else |
| 721 | uInt acc[MULACCLEN*2]; // accumulator in base-billion .. |
| 722 | #endif |
| 723 | uInt *pa; // work -> accumulator |
| 724 | //printf("Base10**9: OpLen=%d MulAcclen=%d\n", OPLEN, MULACCLEN); |
| 725 | |
| 726 | /* Calculate sign and exponent */ |
| 727 | num->sign=(DFWORD(dfl, 0)^DFWORD(dfr, 0)) & DECFLOAT_Sign; |
| 728 | num->exponent=GETEXPUN(dfl)+GETEXPUN(dfr); // [see assertion above] |
| 729 | |
| 730 | /* Extract the coefficients and prepare the accumulator */ |
| 731 | // the coefficients of the operands are decoded into base-billion |
| 732 | // numbers in uInt arrays (bufl and bufr, LSD at offset 0) of the |
| 733 | // appropriate size. |
| 734 | GETCOEFFBILL(dfl, bufl); |
| 735 | GETCOEFFBILL(dfr, bufr); |
| 736 | #if DECTRACE && 0 |
| 737 | printf("CoeffbL:"); |
| 738 | for (ui=bufl+MULOPLEN-1; ui>=bufl; ui--) printf(" %08lx", (LI)*ui); |
| 739 | printf("\n"); |
| 740 | printf("CoeffbR:"); |
| 741 | for (uj=bufr+MULOPLEN-1; uj>=bufr; uj--) printf(" %08lx", (LI)*uj); |
| 742 | printf("\n"); |
| 743 | #endif |
| 744 | |
| 745 | // start the 64-bit/32-bit differing paths... |
| 746 | #if DECUSE64 |
| 747 | |
| 748 | // zero the accumulator |
| 749 | #if MULACCLEN==4 |
| 750 | accl[0]=0; accl[1]=0; accl[2]=0; accl[3]=0; |
| 751 | #else // use a loop |
| 752 | // MULACCLEN is a multiple of four, asserted above |
| 753 | for (pl=accl; pl<accl+MULACCLEN; pl+=4) { |
| 754 | *pl=0; *(pl+1)=0; *(pl+2)=0; *(pl+3)=0;// [reduce overhead] |
| 755 | } // pl |
| 756 | #endif |
| 757 | |
| 758 | /* Effect the multiplication */ |
| 759 | // The multiplcation proceeds using MFC's lazy-carry resolution |
| 760 | // algorithm from decNumber. First, the multiplication is |
| 761 | // effected, allowing accumulation of the partial products (which |
| 762 | // are in base-billion at each column position) into 64 bits |
| 763 | // without resolving back to base=billion after each addition. |
| 764 | // These 64-bit numbers (which may contain up to 19 decimal digits) |
| 765 | // are then split using the Clark & Cowlishaw algorithm (see below). |
no test coverage detected