OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libdecnumber/] [decNumberLocal.h] - Blame information for rev 819

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.