Home | History | Annotate | Download | only in i18n

Lines Matching defs:shift

219   /* multiply, after removing powers of 2 by shifting, and final shift  */
2026 Int shift=set->digits-1;
2028 res->digits=decShiftToMost(res->lsu, 1, shift);
2029 res->exponent=-shift; /* make 1.0000... */
2167 Int shift=set->digits-1;
2168 dac->digits=decShiftToMost(dac->lsu, 1, shift);
2169 dac->exponent=-shift; /* make 1.0000... */
2496 uInt units, shift; /* work */
2505 /* 1. shift all to least up to one unit to unit-align final */
2512 /* 2. shift to least, from below the split point only, so that */
2534 /* Step 1: amount to shift is the partial right-rotate count */
2537 shift=rotate%DECDPUN; /* left-over digits count */
2538 if (shift>0) { /* not an exact number of units */
2539 uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
2540 shift);
2541 if (shift>msudigits) { /* msumax-1 needs >0 digits */
2542 uInt rem=save%powers[shift-msudigits];/* split save */
2543 *msumax=(Unit)(save/powers[shift-msudigits]); /* and insert */
2545 +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); /* .. */
2548 *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); /* [maybe *1] */
2550 } /* digits shift needed */
2555 /* if any, and the shift is DECDPUN-msudigits (which may be */
2557 shift=DECDPUN-msudigits;
2558 if (shift>0) { /* not an exact number of units */
2559 uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
2560 decShiftToLeast(res->lsu, units, shift);
2562 } /* partial shift needed */
2661 /* decNumberShift -- shift the coefficient of a Number left or right */
2667 /* rhs is B, the number of digits to shift (-ve to right) */
2684 Int shift; /* rhs as an Int */
2697 shift=decGetInt(rhs); /* [cannot fail] */
2698 if (shift==BADINT /* something bad .. */
2699 || shift==BIGODD || shift==BIGEVEN /* .. very big .. */
2700 || abs(shift)>set->digits) /* .. or out of range */
2704 if (shift!=0 && !decNumberIsInfinite(res)) { /* something to do */
2705 if (shift>0) { /* to left */
2706 if (shift==set->digits) { /* removing all */
2712 if (res->digits+shift>set->digits) {
2713 decDecap(res, res->digits+shift-set->digits);
2718 res->digits=decShiftToMost(res->lsu, res->digits, shift);
2722 if (-shift>=res->digits) { /* discarding all */
2727 decShiftToLeast(res->lsu, D2U(res->digits), -shift);
2728 res->digits-=(-shift);
2731 } /* non-0 non-Inf shift */
3824 Int rhsshift; /* working shift (in Units) */
3994 rhsshift=0; /* rhs shift to left (padding) in Units */
4018 Int shift=reqdigits-rhs->digits; /* left shift needed */
4024 if (shift>0) {
4025 res->digits=decShiftToMost(res->lsu, res->digits, shift);
4026 res->exponent-=shift; /* adjust the exponent. */
4034 rhsshift=D2U(padding+1)-1; /* this much by Unit shift .. */
4270 Int shift, cut; /* .. */
4490 /* the result will be Unit-aligned. To do this, shift the var1 */
4498 /* Determine the shift to do. */
4512 var2ulen--; /* shift down */
4568 shift=var2ulen-var2units;
4570 decDumpAr('1', &var1[shift], var1units-shift);
4574 decUnitAddSub(&var1[shift], var1units-shift,
4576 &var1[shift], -mult);
4578 decDumpAr('#', &var1[shift], var1units-shift);
4612 var2ulen--; /* shift down */
4706 /* shift var1 the requested amount, and adjust its digits */
4742 *up/=2; /* [shift] */
4865 Int shift; /* Units to shift multiplicand by */
5102 shift=0; /* no multiplicand shift at first */
5109 if (*mer!=0) accunits=decUnitAddSub(&acc[shift], accunits-shift,
5111 &acc[shift], *mer)
5112 + shift;
5118 shift++; /* add this for 'logical length' */
5319 Int shift=set->digits-1;
5322 res->digits=decShiftToMost(res->lsu, 1, shift);
5323 res->exponent=-shift; /* make 1.0000... */
5951 if (res->digits==reqdigits) { /* cannot shift by 1 */
5956 res->digits=decShiftToMost(res->lsu, res->digits, 1); /* shift */
6324 /* shift), or one Unit longer than that (if a Unit carry occurred). */
6336 /* Arg5 is B shift in Units (>=0; pads with 0 units if positive) */
6694 /* decShiftToMost -- shift digits in array towards most significant */
6698 /* shift is the number of zeros to pad with (least significant); */
6706 static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
6711 if (shift==0) return digits; /* [fastpath] nothing to do */
6712 if ((digits+shift)<=DECDPUN) { /* [fastpath] single-unit case */
6713 *uar=(Unit)(*uar*powers[shift]);
6714 return digits+shift;
6719 target=source+D2U(shift); /* where upper part of first cut goes */
6720 cut=DECDPUN-MSUDIGITS(shift); /* where to slice */
6725 first=uar+D2U(digits+shift)-1; /* where msu of source will end up */
6739 } /* shift-move */
6746 return digits+shift;
6750 /* decShiftToLeast -- shift digits in array towards least significant */
6754 /* shift is the number of digits to remove from the lsu end; it */
6762 static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
6767 if (shift==0) return units; /* [fastpath] nothing to do */
6768 if (shift==units*DECDPUN) { /* [fastpath] little to do */
6774 cut=MSUDIGITS(shift);
6776 up=uar+D2U(shift);
6782 up=uar+D2U(shift-cut); /* source; correct to whole Units */
6783 count=units*DECDPUN-shift; /* the maximum new length */
6924 /* copy the coefficient array to the result number; no shift needed */
6986 else { /* shift to least */
6990 /* on unit boundary, so shift-down copy loop is simple */
7031 else { /* shift to least needed */
7034 /* shift-copy the coefficient array to the result number */
7051 } /* shift-copy loop */
7052 } /* shift to least */
7297 Int shift; /* shift needed if clamping */
7347 shift=dn->exponent-(set->emax-set->digits+1);
7349 /* shift coefficient (if non-zero) */
7351 dn->digits=decShiftToMost(dn->lsu, dn->digits, shift);
7353 dn->exponent-=shift; /* adjust the exponent to match */