Lines Matching refs:Unit

153 /*      lsu -- least significant Unit (of coefficient)                */
155 /* msu -- most significant Unit (of coefficient) */
192 static Unit one[] = { 1 }; /* Unit array of 1, used for incrementing */
230 static Int decGetDigits (const Unit *, Int);
241 static void decSetCoeff (decNumber *, decContext *, const Unit *,
245 static Int decShiftToLeast (Unit *, Int, Int);
246 static Int decShiftToMost (Unit *, Int, Int);
251 static Int decUnitAddSub (const Unit *, Int, const Unit *, Int, Int, Unit *, Int);
252 static Int decUnitCompare (const Unit *, Int, const Unit *, Int, Int);
296 static void decDumpAr (char, const Unit *, Int);
356 Unit *res; /* where result will be built */
357 Unit resbuff[D2U (DECBUFFER + 1)]; /* local buffer in case need temporary */
358 Unit *allocres = NULL; /* -> allocated result, iff allocated */
366 Unit *up; /* .. */
563 if (need * sizeof (Unit) > sizeof (resbuff))
565 allocres = (Unit *) malloc (need * sizeof (Unit));
574 /* res now -> number lsu, buffer, or allocated storage for Unit array */
576 /* Place the coefficient into the selected Unit array */
591 *up = (Unit) (X10 (*up) + (Int) * c - (Int) '0');
608 *up = (Unit) ((Int) * c - (Int) '0');
997 uByte dacbuff[sizeof (decNumber) + D2U (DECBUFFER + 9) * sizeof (Unit)];
999 uByte lhsbuff[sizeof (decNumber) + D2U (DECBUFFER + 9) * sizeof (Unit)];
1096 sizeof (decNumber) + (D2U (workset.digits) - 1) * sizeof (Unit);
1361 Unit ret = 0; /* return value */
1469 uByte buff[sizeof (decNumber) + (D2U (DECBUFFER + 1) - 1) * sizeof (Unit)];
1471 uByte bufa[sizeof (decNumber) + (D2U (DECBUFFER + 2) - 1) * sizeof (Unit)];
1473 uByte bufb[sizeof (decNumber) + (D2U (DECBUFFER + 2) - 1) * sizeof (Unit)];
1481 uByte buft[sizeof (decNumber) + (D2U (3) - 1) * sizeof (Unit)];
1550 sizeof (decNumber) + (D2U (rhs->digits) - 1) * sizeof (Unit);
1562 needbytes = sizeof (decNumber) + (D2U (maxp) - 1) * sizeof (Unit);
1896 Unit *d; /* work */
1897 const Unit *s, *smsup; /* work */
2008 Int cut; /* for counting digits in a Unit */
2010 const Unit *up = dn->lsu + D2U (dn->digits) - 1; /* -> msu [input pointer] */
2058 { /* each Unit from msu */
2062 cut = DECDPUN - 1; /* next Unit has all digits */
2114 { /* need new Unit */
2130 { /* need new Unit */
2155 { /* need new Unit */
2241 Unit *acc; /* accumulator for result */
2242 Unit accbuff[D2U (DECBUFFER + 1)]; /* local buffer [+1 is for possible */
2244 Unit *allocacc = NULL; /* -> allocated acc buffer, iff allocated */
2414 *res->lsu = (Unit) partial; /* [copy could have overwritten RHS] */
2426 *res->lsu = (Unit) partial;
2491 rhsshift = D2U (padding + 1) - 1; /* this much by Unit shift .. */
2513 /* we'll need units for maxdigits digits, +1 Unit for carry or borrow */
2516 if (need * sizeof (Unit) > sizeof (accbuff))
2518 allocacc = (Unit *) malloc (need * sizeof (Unit));
2713 Unit accbuff[D2U (DECBUFFER + DECDPUN)]; /* local buffer */
2714 Unit *acc = accbuff; /* -> accumulator array for result */
2715 Unit *allocacc = NULL; /* -> allocated buffer, iff allocated */
2716 Unit *accnext; /* -> where next digit will go */
2721 Unit varbuff[D2U (DECBUFFER * 2 + DECDPUN) * sizeof (Unit)]; /* buffer for var1 */
2722 Unit *var1 = varbuff; /* -> var1 array for long subtraction */
2723 Unit *varalloc = NULL; /* -> allocated buffer, iff used */
2725 const Unit *var2; /* -> var2 array */
2730 Unit *msu1; /* -> msu of each var */
2731 const Unit *msu2; /* -> msu of each var */
2736 Unit thisunit; /* current unit being accumulated */
2743 Unit *target; /* work */
2744 const Unit *source; /* work */
2931 if (acclength * sizeof (Unit) > sizeof (accbuff))
2933 allocacc = (Unit *) malloc (acclength * sizeof (Unit));
2960 if ((var1units + 1) * sizeof (Unit) > sizeof (varbuff))
2962 varalloc = (Unit *) malloc ((var1units + 1) * sizeof (Unit));
3014 /* that the result will be Unit-aligned. To do this, we shift the */
3020 Unit *u;
3067 Unit *pv1, v2; /* units to compare */
3068 const Unit *pv2; /* units to compare */
3112 thisunit = (Unit) (thisunit + mult); /* accumulate */
3165 /* Unit power of ten and go for the next digit */
3198 Unit lsu = *accnext;
3242 Unit *quotlsu; /* for save */
3292 Unit *up; /* .. */
3347 { /* this is the last Unit */
3435 Unit accbuff[D2U (DECBUFFER * 2 + 1)]; /* local buffer (+1 in case DECBUFFER==0) */
3436 Unit *acc = accbuff; /* -> accumulator array for exact result */
3437 Unit *allocacc = NULL; /* -> allocated buffer, iff allocated */
3438 const Unit *mer, *mermsup; /* work */
3512 if (need * sizeof (Unit) > sizeof (accbuff))
3514 allocacc = (Unit *) malloc (need * sizeof (Unit));
3536 /* Here, *mer is the next Unit in the multiplier to use */
3550 /* multiply multiplicand by 10**DECDPUN for next Unit to left */
4012 /* decUnitCompare -- compare two >=0 integers in Unit arrays */
4018 /* Arg1 is A first Unit (lsu) */
4020 /* Arg3 is B first Unit (lsu) */
4028 decUnitCompare (const Unit * a, Int alength, const Unit * b, Int blength, Int exp)
4030 Unit *acc; /* accumulator for result */
4031 Unit accbuff[D2U (DECBUFFER + 1)]; /* local buffer */
4032 Unit *allocacc = NULL; /* -> allocated acc buffer, iff allocated */
4034 const Unit *l, *r, *u; /* work */
4071 if (need * sizeof (Unit) > sizeof (accbuff))
4073 allocacc = (Unit *) malloc (need * sizeof (Unit));
4101 /* decUnitAddSub -- add or subtract two >=0 integers in Unit arrays */
4113 /* shift), or one Unit longer than that (if a Unit carry occurred). */
4121 /* Arg1 is A first Unit (lsu) */
4123 /* Arg3 is B first Unit (lsu) */
4126 /* Arg6 is C first Unit (lsu) */
4135 /* safe, allowing space if necessary for a one-Unit carry. */
4148 decUnitAddSub (const Unit * a, Int alength,
4149 const Unit * b, Int blength, Int bshift, Unit * c, Int m)
4151 const Unit *alsu = a; /* A lsu [need to remember it] */
4152 Unit *clsu = c; /* C ditto */
4153 Unit *minC; /* low water mark for C */
4154 Unit *maxC; /* high water mark for C */
4188 Unit *hold = minC;
4203 /* here carry is new Unit of digits; it could be +ve or -ve */
4206 *c = (Unit) carry;
4215 *c = (Unit) (carry - est * (DECDPUNMAX + 1)); /* remainder */
4226 *c = (Unit) (carry - est * (DECDPUNMAX + 1));
4235 *c = (Unit) (carry - (DECDPUNMAX + 1)); /* [helps additions] */
4241 *c = (Unit) (carry % (DECDPUNMAX + 1));
4247 *c = (Unit) (carry % (DECDPUNMAX + 1));
4267 /* here carry is new Unit of digits; it could be +ve or -ve and */
4271 *c = (Unit) carry;
4281 *c = (Unit) (carry - est * (DECDPUNMAX + 1)); /* remainder */
4292 *c = (Unit) (carry - est * (DECDPUNMAX + 1));
4301 *c = (Unit) (carry - (DECDPUNMAX + 1));
4308 *c = (Unit) (carry % (DECDPUNMAX + 1));
4314 *c = (Unit) (carry % (DECDPUNMAX + 1));
4325 *c = (Unit) carry; /* place as new unit */
4336 *c = (Unit) add;
4351 *c = (Unit) (add - carry - 1);
4373 Unit *up; /* -> current Unit */
4392 cut = 1; /* digit (1-DECDPUN) in Unit */
4393 up = dn->lsu; /* -> current Unit */
4418 { /* need new Unit */
4448 decShiftToMost (Unit * uar, Int digits, Int shift)
4450 Unit *target, *source, *first; /* work */
4459 *uar = (Unit) (*uar * powers[shift]);
4471 /* split the source Unit and accumulate remainder for next */
4481 *target = (Unit) next; /* write to target iff valid */
4482 next = rem * powers[DECDPUN - cut]; /* save remainder for next Unit */
4487 *target = (Unit) next;
4507 decShiftToLeast (Unit * uar, Int units, Int shift)
4509 Unit *target, *up; /* work */
4534 *target = (Unit) quot;
4547 *target = (Unit) (*target + rem * powers[DECDPUN - cut]);
4584 + (D2U (set->digits) - 1) * sizeof (Unit));
4662 decSetCoeff (decNumber * dn, decContext * set, const Unit * lsu,
4667 uInt cut; /* cut point in Unit */
4669 Unit *target; /* work */
4670 const Unit *up; /* work */
4725 /* the Unit with the first discarded digit. When we get there, */
4737 /* here up -> Unit with discarded digit */
4760 { /* it's not at bottom of Unit */
4784 /* here: up -> Unit of the array with discarded digit */
4785 /* cut is the division point for each Unit */
4787 /* Unit, unless cut==0 in which case it's still in *up */
4811 *target = (Unit) quot;
4824 *target = (Unit) (*target + rem * powers[DECDPUN - cut]);
4981 Unit *up; /* work */
4987 /* this is the last Unit (the msu) */
4991 *up = (Unit) powers[count - 1]; /* here 999 -> 100 etc. */
5012 Unit *up, *sup; /* work */
5018 /* this is the last Unit (the msu) */
5023 *up = (Unit) powers[count] - 1; /* here 100 in msu -> 999 */
5026 *up = (Unit) powers[DECDPUN] - 1;
5040 *sup = (Unit) powers[count - 1] - 1; /* here 999.. in msu -> 99.. */
5225 Unit *up; /* work */
5235 *up = (Unit) (powers[count] - 1);
5370 const Unit *up; /* work */
5401 /* spin up whole units until we get to the Unit with the unit digit */
5405 return BADINT; /* non-zero Unit to discard */
5552 /* uar is the Unit array holding the number [this is often an */
5563 decGetDigits (const Unit * uar, Int len)
5565 const Unit *up = uar + len - 1; /* -> msu */
5580 /* found the first non-zero Unit */
5606 const Unit *up; /* work */
5672 decDumpAr (char name, const Unit * ar, Int len)
5768 const Unit *up; /* work */
5852 printf ("Bad Unit [%08x] in number at offset %d [maxuint %d].\n",