Lines Matching +full:- +full:- +full:-

29    02110-1301, USA.  */
31 /* ------------------------------------------------------------------ */
33 /* ------------------------------------------------------------------ */
38 /* ------------------------------------------------------------------ */
49 /* Conditional code flag -- set this to match hardware platform */
50 /* 1=little-endian, 0=big-endian */
57 /* Conditional code flag -- set this to 1 for best performance */
60 /* Conditional check flags -- set these to 0 for best performance */
71 /* ---------------------------------------------------------------- */
72 /* Definitions for all modules (general-purpose) */
73 /* ---------------------------------------------------------------- */
75 /* Local names for common types -- for safety, decNumber modules do */
90 /* Development-use definitions */
100 extern const uByte DECSTICKYTAB[10]; /* re-round digits if sticky */
103 extern const uShort DPD2BIN[1024]; /* DPD -> 0-999 */
104 extern const uShort BIN2DPD[1000]; /* 0-999 -> DPD */
105 extern const uInt DPD2BINK[1024]; /* DPD -> 0-999000 */
106 extern const uInt DPD2BINM[1024]; /* DPD -> 0-999000000 */
107 extern const uByte DPD2BCD8[4096]; /* DPD -> ddd + len */
108 extern const uByte BIN2BCD8[4000]; /* 0-999 -> ddd + len */
109 extern const uShort BCD2DPD[2458]; /* 0-0x999 -> DPD (0x999=2457)*/
111 /* LONGMUL32HI -- set w=(u*v)>>32, where w, u, and v are uInts */
112 /* (that is, sets w to be the high-order word of the 64-bit result; */
113 /* the low-order word is simply u*v.) */
126 /* ROUNDUP -- round an integer up to a multiple of n */
127 #define ROUNDUP(i, n) ((((i)+(n)-1)/n)*n)
129 /* ROUNDDOWN -- round an integer down to a multiple of n */
133 /* References to multi-byte sequences under different sizes */
140 /* X10 and X100 -- multiply integer i by 10 or 100 */
145 /* MAXI and MINI -- general max & min (not in ANSI) for integers */
155 /* ---------------------------------------------------------------- */
156 /* Definitions for arbitrary-precision modules (only valid after */
158 /* ---------------------------------------------------------------- */
163 #define DECNUMMINE -999999999 /* minimum adjusted exponent ditto */
174 /* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN */
175 /* digits, and D2UTABLE -- the initializer for the D2U table */
223 #error DECDPUN must be in the range 1-9
226 /* ----- Shared data (in decNumber.c) ----- */
231 /* ----- Macros ----- */
232 /* ISZERO -- return true if decNumber dn is a zero */
233 /* [performance-critical in some situations] */
236 /* D2U -- return the number of Units needed to hold d digits */
243 #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
245 /* SD2U -- static D2U macro (for compile-time calculation) */
246 #define SD2U(d) (((d)+DECDPUN-1)/DECDPUN)
248 /* MSUDIGITS -- returns digits in msu, from digits, calculated */
250 #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
252 /* D2N -- return the number of decNumber structs that would be */
258 ((((SD2U(d)-1)*sizeof(Unit))+sizeof(decNumber)*2-1)/sizeof(decNumber))
260 /* TODIGIT -- macro to remove the leading digit from the unsigned */
272 if ((u)>=pow) {(u)-=pow; *(c)+=8;} \
274 if ((u)>=pow) {(u)-=pow; *(c)+=4;} \
277 if ((u)>=pow) {(u)-=pow; *(c)+=2;} \
279 if ((u)>=pow) {(u)-=pow; *(c)+=1;} \
282 /* ---------------------------------------------------------------- */
283 /* Definitions for fixed-precision modules (only valid after */
285 /* ---------------------------------------------------------------- */
287 /* bcdnum -- a structure describing a format-independent finite */
290 uByte *msd; /* -> most significant digit */
291 uByte *lsd; /* -> least ditto */
301 #define NUMISSPECIAL(num) (EXPISSPECIAL((num)->exponent))
303 /* Refer to a 32-bit word or byte in a decFloat (df) by big-endian */
306 /* in the next-wider format (decFloatWider, or dfw) */
310 #define DFWORD(df, off) ((df)->words[DECWORDS-1-(off)])
311 #define DFBYTE(df, off) ((df)->bytes[DECBYTES-1-(off)])
312 #define DFWWORD(dfw, off) ((dfw)->words[DECWWORDS-1-(off)])
314 #define DFWORD(df, off) ((df)->words[off])
315 #define DFBYTE(df, off) ((df)->bytes[off])
316 #define DFWWORD(dfw, off) ((dfw)->words[off])
328 extern const uInt DECCOMBMSD[64]; /* Combination field -> MSD */
329 extern const uInt DECCOMBFROM[48]; /* exp+msd -> Combination */
336 /* Format-dependent macros and constants */
347 /* Format-dependent common tests: */
348 /* DFISZERO -- test for (any) zero */
349 /* DFISCCZERO -- test for coefficient continuation being zero */
350 /* DFISCC01 -- test for coefficient contains only 0s and 1s */
351 /* DFISINT -- test for finite and exponent q=0 */
352 /* DFISUINT01 -- test for sign=0, finite, exponent q=0, and */
355 /* In DFISZERO the first test checks the least-significant word */
356 /* (most likely to be non-zero); the penultimate tests MSD and */
407 /* [the top 2 bits will always be in the more-significant uInt] */
408 #define CANONDPDTWO(hi, lo, k) (((hi)&(0x300>>(32-(k))))==0 \
409 || ((hi)&(0x6e>>(32-(k))))!=(0x6e>>(32-(k))) \
412 /* Macro to test whether a full-length (length DECPMAX) BCD8 */
416 #define ISCOEFFZERO(u) (UINTAT((u)+DECPMAX-4)==0 \
417 && UINTAT((u)+DECPMAX-7)==0)
419 #define ISCOEFFZERO(u) (UINTAT((u)+DECPMAX-4)==0 \
420 && (UINTAT((u)+DECPMAX-8)+UINTAT((u)+DECPMAX-12) \
421 +UINTAT((u)+DECPMAX-16))==0)
423 #define ISCOEFFZERO(u) (UINTAT((u)+DECPMAX-4)==0 \
424 && (UINTAT((u)+DECPMAX-8) +UINTAT((u)+DECPMAX-12) \
425 +UINTAT((u)+DECPMAX-16)+UINTAT((u)+DECPMAX-20) \
426 +UINTAT((u)+DECPMAX-24)+UINTAT((u)+DECPMAX-28) \
427 +UINTAT((u)+DECPMAX-32)+USHORTAT((u)+DECPMAX-34))==0)
432 #define GETECON(df) ((Int)((DFWORD((df), 0)&0x03ffffff)>>(32-6-DECECONL)))
433 /* Ditto, from the next-wider format */
434 #define GETWECON(df) ((Int)((DFWWORD((df), 0)&0x03ffffff)>>(32-6-DECWECONL)))
438 #define GETEXPUN(df) ((Int)GETEXP(df)-DECBIAS)
442 /* Compile-time computes of the exponent continuation field masks */
444 #define ECONMASK ((0x03ffffff>>(32-6-DECECONL))<<(32-6-DECECONL))
446 #define ECONNANMASK ((0x01ffffff>>(32-6-DECECONL))<<(32-6-DECECONL))
451 /* In-line sequence to convert 10 bits at right end of uInt dpd */
465 /* to BCD8 using a table lookup (also used for variable-length */
466 /* decode). Each DPD decode is 3 bytes BCD8 plus a one-byte */
467 /* length which is not used, here). Fixed-length 4-byte moves */
475 /* GETWCOEFF extracts the coefficient of the next-wider format. */
476 /* The latter is a copy of the next-wider GETCOEFF using DFWWORD. */
545 /* a base-billion uInt array, with the least-significant */
546 /* 0-999999999 'digit' at offset 0. */
550 /* the usual DPD to binary, the other two pre-multiplied by 1000 */
598 /* a base-thousand uInt array, with the least-significant 0-999 */
660 /* [end of format-dependent macros and constants] */