Home | History | Annotate | Download | only in i18n

Lines Matching defs:shift

234   /* multiply, after removing powers of 2 by shifting, and final shift  */
2041 Int shift=set->digits-1;
2043 res->digits=decShiftToMost(res->lsu, 1, shift);
2044 res->exponent=-shift; /* make 1.0000... */
2182 Int shift=set->digits-1;
2183 dac->digits=decShiftToMost(dac->lsu, 1, shift);
2184 dac->exponent=-shift; /* make 1.0000... */
2511 uInt units, shift; /* work */
2520 /* 1. shift all to least up to one unit to unit-align final */
2527 /* 2. shift to least, from below the split point only, so that */
2549 /* Step 1: amount to shift is the partial right-rotate count */
2552 shift=rotate%DECDPUN; /* left-over digits count */
2553 if (shift>0) { /* not an exact number of units */
2554 uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
2555 decShiftToLeast(res->lsu, D2U(res->digits), shift);
2556 if (shift>msudigits) { /* msumax-1 needs >0 digits */
2557 uInt rem=save%powers[shift-msudigits];/* split save */
2558 *msumax=(Unit)(save/powers[shift-msudigits]); /* and insert */
2560 +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); /* .. */
2563 *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); /* [maybe *1] */
2565 } /* digits shift needed */
2570 /* if any, and the shift is DECDPUN-msudigits (which may be */
2572 shift=DECDPUN-msudigits;
2573 if (shift>0) { /* not an exact number of units */
2574 uInt save=res->lsu[0]%powers[shift]; /* save low digit(s) */
2575 decShiftToLeast(res->lsu, units, shift);
2577 } /* partial shift needed */
2676 /* decNumberShift -- shift the coefficient of a Number left or right */
2682 /* rhs is B, the number of digits to shift (-ve to right) */
2699 Int shift; /* rhs as an Int */
2712 shift=decGetInt(rhs); /* [cannot fail] */
2713 if (shift==BADINT /* something bad .. */
2714 || shift==BIGODD || shift==BIGEVEN /* .. very big .. */
2715 || abs(shift)>set->digits) /* .. or out of range */
2719 if (shift!=0 && !decNumberIsInfinite(res)) { /* something to do */
2720 if (shift>0) { /* to left */
2721 if (shift==set->digits) { /* removing all */
2727 if (res->digits+shift>set->digits) {
2728 decDecap(res, res->digits+shift-set->digits);
2733 res->digits=decShiftToMost(res->lsu, res->digits, shift);
2737 if (-shift>=res->digits) { /* discarding all */
2742 decShiftToLeast(res->lsu, D2U(res->digits), -shift);
2743 res->digits-=(-shift);
2746 } /* non-0 non-Inf shift */
3839 Int rhsshift; /* working shift (in Units) */
4009 rhsshift=0; /* rhs shift to left (padding) in Units */
4033 Int shift=reqdigits-rhs->digits; /* left shift needed */
4039 if (shift>0) {
4040 res->digits=decShiftToMost(res->lsu, res->digits, shift);
4041 res->exponent-=shift; /* adjust the exponent. */
4049 rhsshift=D2U(padding+1)-1; /* this much by Unit shift .. */
4287 Int shift, cut; /* .. */
4507 /* the result will be Unit-aligned. To do this, shift the var1 */
4515 /* Determine the shift to do. */
4529 var2ulen--; /* shift down */
4585 shift=var2ulen-var2units;
4587 decDumpAr('1', &var1[shift], var1units-shift);
4591 decUnitAddSub(&var1[shift], var1units-shift,
4593 &var1[shift], -mult);
4595 decDumpAr('#', &var1[shift], var1units-shift);
4629 var2ulen--; /* shift down */
4723 /* shift var1 the requested amount, and adjust its digits */
4759 *up/=2; /* [shift] */
4882 Int shift; /* Units to shift multiplicand by */
5123 shift=0; /* no multiplicand shift at first */
5130 if (*mer!=0) accunits=decUnitAddSub(&acc[shift], accunits-shift,
5132 &acc[shift], *mer)
5133 + shift;
5139 shift++; /* add this for 'logical length' */
5340 Int shift=set->digits-1;
5343 res->digits=decShiftToMost(res->lsu, 1, shift);
5344 res->exponent=-shift; /* make 1.0000... */
5972 if (res->digits==reqdigits) { /* cannot shift by 1 */
5977 res->digits=decShiftToMost(res->lsu, res->digits, 1); /* shift */
6345 /* shift), or one Unit longer than that (if a Unit carry occurred). */
6357 /* Arg5 is B shift in Units (>=0; pads with 0 units if positive) */
6715 /* decShiftToMost -- shift digits in array towards most significant */
6719 /* shift is the number of zeros to pad with (least significant); */
6727 static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
6732 if (shift==0) return digits; /* [fastpath] nothing to do */
6733 if ((digits+shift)<=DECDPUN) { /* [fastpath] single-unit case */
6734 *uar=(Unit)(*uar*powers[shift]);
6735 return digits+shift;
6740 target=source+D2U(shift); /* where upper part of first cut goes */
6741 cut=DECDPUN-MSUDIGITS(shift); /* where to slice */
6746 first=uar+D2U(digits+shift)-1; /* where msu of source will end up */
6760 } /* shift-move */
6767 return digits+shift;
6771 /* decShiftToLeast -- shift digits in array towards least significant */
6775 /* shift is the number of digits to remove from the lsu end; it */
6783 static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
6788 if (shift==0) return units; /* [fastpath] nothing to do */
6789 if (shift==units*DECDPUN) { /* [fastpath] little to do */
6795 cut=MSUDIGITS(shift);
6797 up=uar+D2U(shift);
6803 up=uar+D2U(shift-cut); /* source; correct to whole Units */
6804 count=units*DECDPUN-shift; /* the maximum new length */
6945 /* copy the coefficient array to the result number; no shift needed */
7007 else { /* shift to least */
7011 /* on unit boundary, so shift-down copy loop is simple */
7053 else { /* shift to least needed */
7056 /* shift-copy the coefficient array to the result number */
7073 } /* shift-copy loop */
7074 } /* shift to least */
7319 Int shift; /* shift needed if clamping */
7369 shift=dn->exponent-(set->emax-set->digits+1);
7371 /* shift coefficient (if non-zero) */
7373 dn->digits=decShiftToMost(dn->lsu, dn->digits, shift);
7375 dn->exponent-=shift; /* adjust the exponent to match */