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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libdecnumber/] [decQuad.h] - Blame information for rev 280

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

Line No. Rev Author Line
1 271 jeremybenn
/* decQuad module header for the decNumber C Library.
2
   Copyright (C) 2007, 2009 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 3, or (at your option) any later
10
   version.
11
 
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.
16
 
17
Under Section 7 of GPL version 3, you are granted additional
18
permissions described in the GCC Runtime Library Exception, version
19
3.1, as published by the Free Software Foundation.
20
 
21
You should have received a copy of the GNU General Public License and
22
a copy of the GCC Runtime Library Exception along with this program;
23
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24
<http://www.gnu.org/licenses/>.  */
25
 
26
/* ------------------------------------------------------------------ */
27
/* decQuad.h -- Decimal 128-bit format module header                  */
28
/* ------------------------------------------------------------------ */
29
/* This include file is always included by decSingle and decDouble,   */
30
/* and therefore also holds useful constants used by all three.       */
31
 
32
#if !defined(DECQUAD)
33
  #define DECQUAD
34
 
35
  #define DECQUADNAME         "decimalQuad"           /* Short name   */
36
  #define DECQUADTITLE        "Decimal 128-bit datum" /* Verbose name */
37
  #define DECQUADAUTHOR       "Mike Cowlishaw"        /* Who to blame */
38
 
39
  /* parameters for decQuads */
40
  #define DECQUAD_Bytes    16      /* length                          */
41
  #define DECQUAD_Pmax     34      /* maximum precision (digits)      */
42
  #define DECQUAD_Emin  -6143      /* minimum adjusted exponent       */
43
  #define DECQUAD_Emax   6144      /* maximum adjusted exponent       */
44
  #define DECQUAD_EmaxD     4      /* maximum exponent digits         */
45
  #define DECQUAD_Bias   6176      /* bias for the exponent           */
46
  #define DECQUAD_String   43      /* maximum string length, +1       */
47
  #define DECQUAD_EconL    12      /* exponent continuation length    */
48
  #define DECQUAD_Declets  11      /* count of declets                */
49
  /* highest biased exponent (Elimit-1) */
50
  #define DECQUAD_Ehigh (DECQUAD_Emax + DECQUAD_Bias - (DECQUAD_Pmax-1))
51
 
52
  /* Required include                                                 */
53
  #include "decContext.h"
54
 
55
  /* The decQuad decimal 128-bit type, accessible by all sizes */
56
  typedef union {
57
    uint8_t   bytes[DECQUAD_Bytes];     /* fields: 1, 5, 12, 110 bits */
58
    uint16_t shorts[DECQUAD_Bytes/2];
59
    uint32_t  words[DECQUAD_Bytes/4];
60
    #if DECUSE64
61
    uint64_t  longs[DECQUAD_Bytes/8];
62
    #endif
63
    } decQuad;
64
 
65
  /* ---------------------------------------------------------------- */
66
  /* Shared constants                                                 */
67
  /* ---------------------------------------------------------------- */
68
 
69
  /* sign and special values [top 32-bits; last two bits are don't-care
70
     for Infinity on input, last bit don't-care for NaNs] */
71
  #define DECFLOAT_Sign  0x80000000     /* 1 00000 00 Sign */
72
  #define DECFLOAT_NaN   0x7c000000     /* 0 11111 00 NaN generic */
73
  #define DECFLOAT_qNaN  0x7c000000     /* 0 11111 00 qNaN */
74
  #define DECFLOAT_sNaN  0x7e000000     /* 0 11111 10 sNaN */
75
  #define DECFLOAT_Inf   0x78000000     /* 0 11110 00 Infinity */
76
  #define DECFLOAT_MinSp 0x78000000     /* minimum special value */
77
                                        /* [specials are all >=MinSp] */
78
  /* Sign nibble constants                                            */
79
  #if !defined(DECPPLUSALT)
80
    #define DECPPLUSALT  0x0A /* alternate plus  nibble               */
81
    #define DECPMINUSALT 0x0B /* alternate minus nibble               */
82
    #define DECPPLUS     0x0C /* preferred plus  nibble               */
83
    #define DECPMINUS    0x0D /* preferred minus nibble               */
84
    #define DECPPLUSALT2 0x0E /* alternate plus  nibble               */
85
    #define DECPUNSIGNED 0x0F /* alternate plus  nibble (unsigned)    */
86
  #endif
87
 
88
  /* ---------------------------------------------------------------- */
89
  /* Routines -- implemented as decFloat routines in common files     */
90
  /* ---------------------------------------------------------------- */
91
 
92
  #include "decQuadSymbols.h"
93
 
94
  /* Utilities and conversions, extractors, etc.) */
95
  extern decQuad * decQuadFromBCD(decQuad *, int32_t, const uint8_t *, int32_t);
96
  extern decQuad * decQuadFromInt32(decQuad *, int32_t);
97
  extern decQuad * decQuadFromPacked(decQuad *, int32_t, const uint8_t *);
98
  extern decQuad * decQuadFromPackedChecked(decQuad *, int32_t, const uint8_t *);
99
  extern decQuad * decQuadFromString(decQuad *, const char *, decContext *);
100
  extern decQuad * decQuadFromUInt32(decQuad *, uint32_t);
101
  extern int32_t   decQuadGetCoefficient(const decQuad *, uint8_t *);
102
  extern int32_t   decQuadGetExponent(const decQuad *);
103
  extern decQuad * decQuadSetCoefficient(decQuad *, const uint8_t *, int32_t);
104
  extern decQuad * decQuadSetExponent(decQuad *, decContext *, int32_t);
105
  extern void      decQuadShow(const decQuad *, const char *);
106
  extern int32_t   decQuadToBCD(const decQuad *, int32_t *, uint8_t *);
107
  extern char    * decQuadToEngString(const decQuad *, char *);
108
  extern int32_t   decQuadToInt32(const decQuad *, decContext *, enum rounding);
109
  extern int32_t   decQuadToInt32Exact(const decQuad *, decContext *, enum rounding);
110
  extern int32_t   decQuadToPacked(const decQuad *, int32_t *, uint8_t *);
111
  extern char    * decQuadToString(const decQuad *, char *);
112
  extern uint32_t  decQuadToUInt32(const decQuad *, decContext *, enum rounding);
113
  extern uint32_t  decQuadToUInt32Exact(const decQuad *, decContext *, enum rounding);
114
  extern decQuad * decQuadZero(decQuad *);
115
 
116
  /* Computational (result is a decQuad) */
117
  extern decQuad * decQuadAbs(decQuad *, const decQuad *, decContext *);
118
  extern decQuad * decQuadAdd(decQuad *, const decQuad *, const decQuad *, decContext *);
119
  extern decQuad * decQuadAnd(decQuad *, const decQuad *, const decQuad *, decContext *);
120
  extern decQuad * decQuadDivide(decQuad *, const decQuad *, const decQuad *, decContext *);
121
  extern decQuad * decQuadDivideInteger(decQuad *, const decQuad *, const decQuad *, decContext *);
122
  extern decQuad * decQuadFMA(decQuad *, const decQuad *, const decQuad *, const decQuad *, decContext *);
123
  extern decQuad * decQuadInvert(decQuad *, const decQuad *, decContext *);
124
  extern decQuad * decQuadLogB(decQuad *, const decQuad *, decContext *);
125
  extern decQuad * decQuadMax(decQuad *, const decQuad *, const decQuad *, decContext *);
126
  extern decQuad * decQuadMaxMag(decQuad *, const decQuad *, const decQuad *, decContext *);
127
  extern decQuad * decQuadMin(decQuad *, const decQuad *, const decQuad *, decContext *);
128
  extern decQuad * decQuadMinMag(decQuad *, const decQuad *, const decQuad *, decContext *);
129
  extern decQuad * decQuadMinus(decQuad *, const decQuad *, decContext *);
130
  extern decQuad * decQuadMultiply(decQuad *, const decQuad *, const decQuad *, decContext *);
131
  extern decQuad * decQuadNextMinus(decQuad *, const decQuad *, decContext *);
132
  extern decQuad * decQuadNextPlus(decQuad *, const decQuad *, decContext *);
133
  extern decQuad * decQuadNextToward(decQuad *, const decQuad *, const decQuad *, decContext *);
134
  extern decQuad * decQuadOr(decQuad *, const decQuad *, const decQuad *, decContext *);
135
  extern decQuad * decQuadPlus(decQuad *, const decQuad *, decContext *);
136
  extern decQuad * decQuadQuantize(decQuad *, const decQuad *, const decQuad *, decContext *);
137
  extern decQuad * decQuadReduce(decQuad *, const decQuad *, decContext *);
138
  extern decQuad * decQuadRemainder(decQuad *, const decQuad *, const decQuad *, decContext *);
139
  extern decQuad * decQuadRemainderNear(decQuad *, const decQuad *, const decQuad *, decContext *);
140
  extern decQuad * decQuadRotate(decQuad *, const decQuad *, const decQuad *, decContext *);
141
  extern decQuad * decQuadScaleB(decQuad *, const decQuad *, const decQuad *, decContext *);
142
  extern decQuad * decQuadShift(decQuad *, const decQuad *, const decQuad *, decContext *);
143
  extern decQuad * decQuadSubtract(decQuad *, const decQuad *, const decQuad *, decContext *);
144
  extern decQuad * decQuadToIntegralValue(decQuad *, const decQuad *, decContext *, enum rounding);
145
  extern decQuad * decQuadToIntegralExact(decQuad *, const decQuad *, decContext *);
146
  extern decQuad * decQuadXor(decQuad *, const decQuad *, const decQuad *, decContext *);
147
 
148
  /* Comparisons */
149
  extern decQuad * decQuadCompare(decQuad *, const decQuad *, const decQuad *, decContext *);
150
  extern decQuad * decQuadCompareSignal(decQuad *, const decQuad *, const decQuad *, decContext *);
151
  extern decQuad * decQuadCompareTotal(decQuad *, const decQuad *, const decQuad *);
152
  extern decQuad * decQuadCompareTotalMag(decQuad *, const decQuad *, const decQuad *);
153
 
154
  /* Copies */
155
  extern decQuad * decQuadCanonical(decQuad *, const decQuad *);
156
  extern decQuad * decQuadCopy(decQuad *, const decQuad *);
157
  extern decQuad * decQuadCopyAbs(decQuad *, const decQuad *);
158
  extern decQuad * decQuadCopyNegate(decQuad *, const decQuad *);
159
  extern decQuad * decQuadCopySign(decQuad *, const decQuad *, const decQuad *);
160
 
161
  /* Non-computational */
162
  extern enum decClass decQuadClass(const decQuad *);
163
  extern const char *  decQuadClassString(const decQuad *);
164
  extern uint32_t      decQuadDigits(const decQuad *);
165
  extern uint32_t      decQuadIsCanonical(const decQuad *);
166
  extern uint32_t      decQuadIsFinite(const decQuad *);
167
  extern uint32_t      decQuadIsInteger(const decQuad *);
168
  extern uint32_t      decQuadIsInfinite(const decQuad *);
169
  extern uint32_t      decQuadIsNaN(const decQuad *);
170
  extern uint32_t      decQuadIsNormal(const decQuad *);
171
  extern uint32_t      decQuadIsSignaling(const decQuad *);
172
  extern uint32_t      decQuadIsSignalling(const decQuad *);
173
  extern uint32_t      decQuadIsSigned(const decQuad *);
174
  extern uint32_t      decQuadIsSubnormal(const decQuad *);
175
  extern uint32_t      decQuadIsZero(const decQuad *);
176
  extern uint32_t      decQuadRadix(const decQuad *);
177
  extern uint32_t      decQuadSameQuantum(const decQuad *, const decQuad *);
178
  extern const char *  decQuadVersion(void);
179
 
180
  /* decNumber conversions; these are implemented as macros so as not  */
181
  /* to force a dependency on decimal128 and decNumber in decQuad.     */
182
  /* decQuadFromNumber returns a decimal128 * to avoid warnings.       */
183
  #define decQuadToNumber(dq, dn) decimal128ToNumber((decimal128 *)(dq), dn)
184
  #define decQuadFromNumber(dq, dn, set) decimal128FromNumber((decimal128 *)(dq), dn, set)
185
 
186
#endif

powered by: WebSVN 2.1.0

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