alias.h (ALIAS_SET_MEMORY_BARRIER): New.
[official-gcc.git] / libdecnumber / decNumberLocal.h
blob22d8d952bf7f8fb7218af89422ceab9d905a047d
1 /* decNumber package local type, tuning, and macro definitions.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3 Contributed by IBM Corporation. Author Mike Cowlishaw.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA. */
22 /* ------------------------------------------------------------------ */
23 /* This header file is included by all modules in the decNumber */
24 /* library, and contains local type definitions, tuning parameters, */
25 /* etc. It must only be included once, and should not need to be */
26 /* used by application programs. decNumber.h must be included first. */
27 /* ------------------------------------------------------------------ */
29 #if !defined(DECNUMBERLOC)
30 #define DECNUMBERLOC
31 #define DECNLAUTHOR "Mike Cowlishaw" /* Who to blame */
33 /* Local names for common types -- decNumber modules do not use int or
34 long directly */
35 #define Flag uint8_t
36 #define Byte int8_t
37 #define uByte uint8_t
38 #define Short int16_t
39 #define uShort uint16_t
40 #define Int int32_t
41 #define uInt uint32_t
42 #define Unit decNumberUnit
45 /* Tuning parameter */
46 #define DECBUFFER 36 /* Maximum size basis for local buffers. */
47 /* Should be a common maximum precision */
48 /* rounded up to a multiple of 4; must */
49 /* be non-negative. */
51 /* Conditional code flags -- set these to 0 for best performance */
52 #define DECCHECK 0 /* 1 to enable robust checking */
53 #define DECALLOC 0 /* 1 to enable memory allocation accounting */
54 #define DECTRACE 0 /* 1 to trace critical intermediates, etc. */
57 /* Development use defines */
58 #if DECALLOC
59 /* if these interfere with your C includes, just comment them out */
60 #define int ? /* enable to ensure we do not use plain C */
61 #define long ?? /* .. 'int' or 'long' types from here on */
62 #endif
64 /* Limits and constants */
65 #define DECNUMMAXP 999999999 /* maximum precision we can handle (9 digits) */
66 #define DECNUMMAXE 999999999 /* maximum adjusted exponent ditto (9 digits) */
67 #define DECNUMMINE -999999999 /* minimum adjusted exponent ditto (9 digits) */
68 #if (DECNUMMAXP != DEC_MAX_DIGITS)
69 #error Maximum digits mismatch
70 #endif
71 #if (DECNUMMAXE != DEC_MAX_EMAX)
72 #error Maximum exponent mismatch
73 #endif
74 #if (DECNUMMINE != DEC_MIN_EMIN)
75 #error Minimum exponent mismatch
76 #endif
78 /* Set DECDPUNMAX -- the maximum integer that fits in DECDPUN digits */
79 #if DECDPUN==1
80 #define DECDPUNMAX 9
81 #elif DECDPUN==2
82 #define DECDPUNMAX 99
83 #elif DECDPUN==3
84 #define DECDPUNMAX 999
85 #elif DECDPUN==4
86 #define DECDPUNMAX 9999
87 #elif DECDPUN==5
88 #define DECDPUNMAX 99999
89 #elif DECDPUN==6
90 #define DECDPUNMAX 999999
91 #elif DECDPUN==7
92 #define DECDPUNMAX 9999999
93 #elif DECDPUN==8
94 #define DECDPUNMAX 99999999
95 #elif DECDPUN==9
96 #define DECDPUNMAX 999999999
97 #elif defined(DECDPUN)
98 #error DECDPUN must be in the range 1-9
99 #endif
102 /* ----- Shared data ----- */
103 /* The powers of of ten array (powers[n]==10**n, 0<=n<=10) */
104 extern const uInt powers[];
106 /* ----- Macros ----- */
107 /* ISZERO -- return true if decNumber dn is a zero */
108 /* [performance-critical in some situations] */
109 #define ISZERO(dn) decNumberIsZero(dn) /* now just a local name */
111 /* X10 and X100 -- multiply integer i by 10 or 100 */
112 /* [shifts are usually faster than multiply; could be conditional] */
113 #define X10(i) (((i)<<1)+((i)<<3))
114 #define X100(i) (((i)<<2)+((i)<<5)+((i)<<6))
116 /* D2U -- return the number of Units needed to hold d digits */
117 #if DECDPUN==8
118 #define D2U(d) ((unsigned)((d)+7)>>3)
119 #elif DECDPUN==4
120 #define D2U(d) ((unsigned)((d)+3)>>2)
121 #else
122 #define D2U(d) (((d)+DECDPUN-1)/DECDPUN)
123 #endif
125 #else
126 #error decNumberLocal included more than once
127 #endif