Lines Matching refs:Unit

202 static Unit uarrone[1]={1};   /* Unit array of 1, used for incrementing */
241 static Int decGetDigits(Unit *, Int);
253 static void decReverse(Unit *, Unit *);
254 static void decSetCoeff(decNumber *, decContext *, const Unit *,
259 static Int decShiftToLeast(Unit *, Int, Int);
260 static Int decShiftToMost(Unit *, Int, Int);
264 static Int decUnitAddSub(const Unit *, Int, const Unit *, Int, Int,
265 Unit *, Int);
266 static Int decUnitCompare(const Unit *, Int, const Unit *, Int, Int);
322 static void decDumpAr(char, const Unit *, Int);
352 Unit *up; /* work pointer */ in decNumberFromUInt32()
356 *up=(Unit)(uin%(DECDPUNMAX+1)); in decNumberFromUInt32()
382 const Unit *up; /* .. */ in decNumberToInt32()
418 const Unit *up; /* .. */ in decNumberToUInt32()
454 Unit *up; /* work pointer */ in decNumberFromUInt64()
460 *up = (Unit)(uin % (DECDPUNMAX + 1)); in decNumberFromUInt64()
489 Unit *up; /* work pointer */ in decNumberFromUInt128()
496 *up = (Unit)rem; in decNumberFromUInt128()
521 const Unit *up; /* .. */ in decNumberIntegralToInt64()
562 const Unit *up; /* .. */ in decNumberIntegralToInt128()
657 Unit *res; /* where result will be built */ in decNumberFromString()
658 Unit resbuff[SD2U(DECBUFFER+9)];/* local buffer in case need temporary */ in decNumberFromString()
660 Unit *allocres=NULL; /* -> allocated result, iff allocated */ in decNumberFromString()
666 Unit *up; /* .. */ in decNumberFromString()
817 Int needbytes=D2U(d)*sizeof(Unit);/* bytes needed */ in decNumberFromString()
820 allocres=(Unit *)malloc(needbytes); in decNumberFromString()
839 *up=(Unit)out; /* write unit */ in decNumberFromString()
844 *up=(Unit)out; /* write lsu */ in decNumberFromString()
851 *up=(Unit)((Int)*c-(Int)'0'); in decNumberFromString()
962 const Unit *ua, *ub; /* -> operands */ in decNumberAnd()
963 const Unit *msua, *msub; /* -> operand msus */ in decNumberAnd()
964 Unit *uc, *msuc; /* -> result and its msu */ in decNumberAnd()
985 Unit a, b; /* extract units */ in decNumberAnd()
996 if (a&b&1) *uc=*uc+(Unit)powers[i]; /* effect AND */ in decNumberAnd()
1108 needbytes=sizeof(decNumber)+(D2U(lhs->digits)-1)*sizeof(Unit); in decNumberCompareTotalMag()
1122 needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); in decNumberCompareTotalMag()
1301 needbytes=sizeof(decNumber)+(D2U(dcmul.digits)-1)*sizeof(Unit); in decNumberFMA()
1360 const Unit *ua, *msua; /* -> operand and its msu */ in decNumberInvert()
1361 Unit *uc, *msuc; /* -> result and its msu */ in decNumberInvert()
1378 Unit a; /* extract unit */ in decNumberInvert()
1386 if ((~a)&1) *uc=*uc+(Unit)powers[i]; /* effect INVERT */ in decNumberInvert()
1630 needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit); in decNumberLog10()
1653 needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit); in decNumberLog10()
1970 const Unit *ua, *ub; /* -> operands */ in decNumberOr()
1971 const Unit *msua, *msub; /* -> operand msus */ in decNumberOr()
1972 Unit *uc, *msuc; /* -> result and its msu */ in decNumberOr()
1992 Unit a, b; /* extract units */ in decNumberOr()
2002 if ((a|b)&1) *uc=*uc+(Unit)powers[i]; /* effect OR */ in decNumberOr()
2296 needbytes=sizeof(decNumber)+(D2U(aset.digits)-1)*sizeof(Unit); in decNumberPower()
2647 Unit *msu=res->lsu+D2U(res->digits)-1; /* current msu */ in decNumberRotate()
2648 Unit *msumax=res->lsu+D2U(set->digits)-1; /* rotation msu */ in decNumberRotate()
2692 *msumax=(Unit)(save/powers[shift-msudigits]); /* and insert */ in decNumberRotate()
2694 +(Unit)(rem*powers[DECDPUN-(shift-msudigits)]); /* .. */ in decNumberRotate()
2697 *msumax=*msumax+(Unit)(save*powers[msudigits-shift]); /* [maybe *1] */ in decNumberRotate()
2710 *msumax=*msumax+(Unit)(save*powers[msudigits]); in decNumberRotate()
2740 Unit ret=0; /* return value */ in decNumberSameQuantum()
3051 needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); in decNumberSquareRoot()
3060 needbytes=sizeof(decNumber)+(D2U(maxp)-1)*sizeof(Unit); in decNumberSquareRoot()
3384 const Unit *ua, *ub; /* -> operands */ in decNumberXor()
3385 const Unit *msua, *msub; /* -> operand msus */ in decNumberXor()
3386 Unit *uc, *msuc; /* -> result and its msu */ in decNumberXor()
3406 Unit a, b; /* extract units */ in decNumberXor()
3416 if ((a^b)&1) *uc=*uc+(Unit)powers[i]; /* effect XOR */ in decNumberXor()
3517 const Unit *smsup, *s; /* work */ in decNumberCopy()
3518 Unit *d; /* .. */ in decNumberCopy()
3607 const Unit *up=dn->lsu; /* Unit pointer, -> lsu */ in decNumberGetBCD()
3640 Unit *up = dn->lsu + D2U(n) - 1; /* -> msu [target pointer] */ in decNumberSetBCD()
3774 const Unit *up=dn->lsu+D2U(dn->digits)-1; /* -> msu [input pointer] */ in decToString()
3963 Unit *acc; /* accumulator for result */ in decAddOp()
3964 Unit accbuff[SD2U(DECBUFFER*2+20)]; /* local buffer [*2+20 reduces many */ in decAddOp()
3967 Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */ in decAddOp()
4102 *res->lsu=(Unit)partial; /* [copy could have overwritten RHS] */ in decAddOp()
4111 *res->lsu=(Unit)partial; in decAddOp()
4189 if (need*sizeof(Unit)>sizeof(accbuff)) { in decAddOp()
4191 allocacc=(Unit *)malloc(need*sizeof(Unit)); in decAddOp()
4371 Unit accbuff[SD2U(DECBUFFER+DECDPUN+10)]; /* local buffer */ in decDivideOp()
4372 Unit *acc=accbuff; /* -> accumulator array for result */ in decDivideOp()
4373 Unit *allocacc=NULL; /* -> allocated buffer, iff allocated */ in decDivideOp()
4374 Unit *accnext; /* -> where next digit will go */ in decDivideOp()
4379 Unit varbuff[SD2U(DECBUFFER*2+DECDPUN)*sizeof(Unit)]; /* buffer for var1 */ in decDivideOp()
4380 Unit *var1=varbuff; /* -> var1 array for long subtraction */ in decDivideOp()
4381 Unit *varalloc=NULL; /* -> allocated buffer, iff used */ in decDivideOp()
4382 Unit *msu1; /* -> msu of var1 */ in decDivideOp()
4384 const Unit *var2; /* -> var2 array */ in decDivideOp()
4385 const Unit *msu2; /* -> msu of var2 */ in decDivideOp()
4394 Unit thisunit; /* current unit being accumulated */ in decDivideOp()
4400 Unit *target; /* work */ in decDivideOp()
4401 const Unit *source; /* .. */ in decDivideOp()
4552 if (acclength*sizeof(Unit)>sizeof(accbuff)) { in decDivideOp()
4554 allocacc=(Unit *)malloc(acclength*sizeof(Unit)); in decDivideOp()
4577 if ((var1units+1)*sizeof(Unit)>sizeof(varbuff)) { in decDivideOp()
4579 varalloc=(Unit *)malloc((var1units+1)*sizeof(Unit)); in decDivideOp()
4628 Unit *u; /* work */ in decDivideOp()
4665 const Unit *pv1, *pv2; in decDivideOp()
4666 Unit v2; /* units to compare */ in decDivideOp()
4698 thisunit=(Unit)(thisunit+mult); /* accumulate */ in decDivideOp()
4772 Unit lsu=*accnext; in decDivideOp()
4807 Unit *quotlsu; /* for save */ in decDivideOp()
4853 Unit *up; /* .. */ in decDivideOp()
4991 Unit *acc; /* -> accumulator Unit array */ in decMultiplyOp()
4994 Unit accbuff[SD2U(DECBUFFER*4+1)]; /* buffer (+1 for DECBUFFER==0, */ in decMultiplyOp()
4996 const Unit *mer, *mermsup; /* work */ in decMultiplyOp()
5034 const Unit *cup; /* .. */ in decMultiplyOp()
5035 Unit *up; /* .. */ in decMultiplyOp()
5133 acc=(Unit *)zacc; /* -> target Unit array */ in decMultiplyOp()
5209 *up=(Unit)(item-(part*(DECDPUNMAX+1))); in decMultiplyOp()
5212 *up=(Unit)item; up++; /* [final needs no division] */ in decMultiplyOp()
5221 needbytes=(D2U(lhs->digits)+D2U(rhs->digits))*sizeof(Unit); in decMultiplyOp()
5223 allocacc=(Unit *)malloc(needbytes); in decMultiplyOp()
5225 acc=(Unit *)allocacc; /* use the allocated space */ in decMultiplyOp()
5508 needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit); in decExpOp()
5540 needbytes=sizeof(decNumber)+(D2U(p*2)-1)*sizeof(Unit); in decExpOp()
5552 needbytes=sizeof(decNumber)+(D2U(p+2)-1)*sizeof(Unit); in decExpOp()
5818 needbytes=sizeof(decNumber)+(D2U(MAXI(p,16))-1)*sizeof(Unit);
5827 needbytes=sizeof(decNumber)+(D2U(MAXI(pp,16))-1)*sizeof(Unit);
6381 static Int decUnitCompare(const Unit *a, Int alength,
6382 const Unit *b, Int blength, Int exp) {
6383 Unit *acc; /* accumulator for result */
6384 Unit accbuff[SD2U(DECBUFFER*2+1)]; /* local buffer */
6385 Unit *allocacc=NULL; /* -> allocated acc buffer, iff allocated */
6387 const Unit *l, *r, *u; /* work */
6415 if (need*sizeof(Unit)>sizeof(accbuff)) {
6416 allocacc=(Unit *)malloc(need*sizeof(Unit));
6485 static Int decUnitAddSub(const Unit *a, Int alength,
6486 const Unit *b, Int blength, Int bshift,
6487 Unit *c, Int m) {
6488 const Unit *alsu=a; /* A lsu [need to remember it] */
6489 Unit *clsu=c; /* C ditto */
6490 Unit *minC; /* low water mark for C */
6491 Unit *maxC; /* high water mark for C */
6518 Unit *hold=minC;
6534 *c=(Unit)carry;
6541 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6551 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6559 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6569 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6578 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6585 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6590 *c=(Unit)(carry-(DECDPUNMAX+1)); /* [helps additions] */
6595 *c=(Unit)(carry%(DECDPUNMAX+1));
6601 *c=(Unit)(carry%(DECDPUNMAX+1));
6620 *c=(Unit)carry;
6628 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6638 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6646 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6656 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6664 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6671 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6675 *c=(Unit)(carry-(DECDPUNMAX+1));
6681 *c=(Unit)(carry%(DECDPUNMAX+1));
6687 *c=(Unit)(carry%(DECDPUNMAX+1));
6696 *c=(Unit)carry; /* place as new unit */
6705 *c=(Unit)add;
6718 *c=(Unit)(add-carry-1);
6742 Unit *up; /* -> current Unit */
6809 static void decReverse(Unit *ulo, Unit *uhi) {
6810 Unit temp;
6832 static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
6833 Unit *target, *source, *first; /* work */
6839 *uar=(Unit)(*uar*powers[shift]);
6862 if (target<=first) *target=(Unit)next; /* write to target iff valid */
6869 *target=(Unit)next;
6888 static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
6889 Unit *target, *up; /* work */
6916 *target=(Unit)quot;
6928 *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
6963 +(D2U(set->digits)-1)*sizeof(Unit));
7036 static void decSetCoeff(decNumber *dn, decContext *set, const Unit *lsu,
7040 const Unit *up; /* work */
7041 Unit *target; /* .. */
7099 Unit half=(Unit)powers[DECDPUN]>>1;
7162 *target=(Unit)quot;
7174 *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
7304 Unit *up; /* work */
7311 *up=(Unit)powers[count-1]; /* here 999 -> 100 etc. */
7328 Unit *up, *sup; /* work */
7336 *up=(Unit)powers[count]-1; /* here 100 in msu -> 999 */
7338 for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1;
7349 *sup=(Unit)powers[count-1]-1; /* here 999.. in msu -> 99.. */
7542 Unit *up; /* work */
7549 *up=(Unit)(powers[count]-1);
7691 const Unit *up; /* work */
7779 Unit *msu; /* -> target cut point */
7855 const Unit *ul;
7856 Unit *ur, *uresp1;
7914 static Int decGetDigits(Unit *uar, Int len) {
7915 Unit *up=uar+(len-1); /* -> msu */
7993 const Unit *up; /* work */
8044 static void decDumpAr(char name, const Unit *ar, Int len) {
8136 const Unit *up; /* work */