Mercurial > hg > CbC > CbC_gcc
comparison libdecnumber/decQuad.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
24 <http://www.gnu.org/licenses/>. */ | 24 <http://www.gnu.org/licenses/>. */ |
25 | 25 |
26 /* ------------------------------------------------------------------ */ | 26 /* ------------------------------------------------------------------ */ |
27 /* decQuad.h -- Decimal 128-bit format module header */ | 27 /* decQuad.h -- Decimal 128-bit format module header */ |
28 /* ------------------------------------------------------------------ */ | 28 /* ------------------------------------------------------------------ */ |
29 /* Please see decFloats.h for an overview and documentation details. */ | |
30 /* ------------------------------------------------------------------ */ | |
31 /* This include file is always included by decSingle and decDouble, */ | 29 /* This include file is always included by decSingle and decDouble, */ |
32 /* and therefore also holds useful constants used by all three. */ | 30 /* and therefore also holds useful constants used by all three. */ |
33 | 31 |
34 #if !defined(DECQUAD) | 32 #if !defined(DECQUAD) |
35 #define DECQUAD | 33 #define DECQUAD |
36 | 34 |
37 #define DECQUADNAME "decimalQuad" /* Short name */ | 35 #define DECQUADNAME "decimalQuad" /* Short name */ |
38 #define DECQUADTITLE "Decimal 128-bit datum" /* Verbose name */ | 36 #define DECQUADTITLE "Decimal 128-bit datum" /* Verbose name */ |
39 #define DECQUADAUTHOR "Mike Cowlishaw" /* Who to blame */ | 37 #define DECQUADAUTHOR "Mike Cowlishaw" /* Who to blame */ |
40 | 38 |
41 /* parameters for decQuads */ | 39 /* parameters for decQuads */ |
42 #define DECQUAD_Bytes 16 /* length */ | 40 #define DECQUAD_Bytes 16 /* length */ |
43 #define DECQUAD_Pmax 34 /* maximum precision (digits) */ | 41 #define DECQUAD_Pmax 34 /* maximum precision (digits) */ |
44 #define DECQUAD_Emin -6143 /* minimum adjusted exponent */ | 42 #define DECQUAD_Emin -6143 /* minimum adjusted exponent */ |
45 #define DECQUAD_Emax 6144 /* maximum adjusted exponent */ | 43 #define DECQUAD_Emax 6144 /* maximum adjusted exponent */ |
46 #define DECQUAD_EmaxD 4 /* maximum exponent digits */ | 44 #define DECQUAD_EmaxD 4 /* maximum exponent digits */ |
47 #define DECQUAD_Bias 6176 /* bias for the exponent */ | 45 #define DECQUAD_Bias 6176 /* bias for the exponent */ |
48 #define DECQUAD_String 43 /* maximum string length, +1 */ | 46 #define DECQUAD_String 43 /* maximum string length, +1 */ |
49 #define DECQUAD_EconL 12 /* exponent continuation length */ | 47 #define DECQUAD_EconL 12 /* exponent continuation length */ |
50 #define DECQUAD_Declets 11 /* count of declets */ | 48 #define DECQUAD_Declets 11 /* count of declets */ |
51 /* highest biased exponent (Elimit-1) */ | 49 /* highest biased exponent (Elimit-1) */ |
52 #define DECQUAD_Ehigh (DECQUAD_Emax + DECQUAD_Bias - (DECQUAD_Pmax-1)) | 50 #define DECQUAD_Ehigh (DECQUAD_Emax + DECQUAD_Bias - (DECQUAD_Pmax-1)) |
53 | 51 |
54 /* Required include */ | 52 /* Required include */ |
55 #include "decContext.h" | 53 #include "decContext.h" |
56 | 54 |
57 /* The decQuad decimal 128-bit type, accessible by various types */ | 55 /* The decQuad decimal 128-bit type, accessible by all sizes */ |
58 typedef union { | 56 typedef union { |
59 uint8_t bytes[DECQUAD_Bytes]; /* fields: 1, 5, 12, 110 bits */ | 57 uint8_t bytes[DECQUAD_Bytes]; /* fields: 1, 5, 12, 110 bits */ |
60 uint16_t shorts[DECQUAD_Bytes/2]; | 58 uint16_t shorts[DECQUAD_Bytes/2]; |
61 uint32_t words[DECQUAD_Bytes/4]; | 59 uint32_t words[DECQUAD_Bytes/4]; |
60 #if DECUSE64 | |
61 uint64_t longs[DECQUAD_Bytes/8]; | |
62 #endif | |
62 } decQuad; | 63 } decQuad; |
63 | 64 |
64 /* ---------------------------------------------------------------- */ | 65 /* ---------------------------------------------------------------- */ |
65 /* Shared constants */ | 66 /* Shared constants */ |
66 /* ---------------------------------------------------------------- */ | 67 /* ---------------------------------------------------------------- */ |
67 | 68 |
68 /* sign and special values [top 32-bits; last two bits are don't-care | 69 /* sign and special values [top 32-bits; last two bits are don't-care |
69 for Infinity on input, last bit don't-care for NaNs] */ | 70 for Infinity on input, last bit don't-care for NaNs] */ |
70 #define DECFLOAT_Sign 0x80000000 /* 1 00000 00 Sign */ | 71 #define DECFLOAT_Sign 0x80000000 /* 1 00000 00 Sign */ |
71 #define DECFLOAT_NaN 0x7c000000 /* 0 11111 00 NaN generic */ | 72 #define DECFLOAT_NaN 0x7c000000 /* 0 11111 00 NaN generic */ |
72 #define DECFLOAT_qNaN 0x7c000000 /* 0 11111 00 qNaN */ | 73 #define DECFLOAT_qNaN 0x7c000000 /* 0 11111 00 qNaN */ |
73 #define DECFLOAT_sNaN 0x7e000000 /* 0 11111 10 sNaN */ | 74 #define DECFLOAT_sNaN 0x7e000000 /* 0 11111 10 sNaN */ |
74 #define DECFLOAT_Inf 0x78000000 /* 0 11110 00 Infinity */ | 75 #define DECFLOAT_Inf 0x78000000 /* 0 11110 00 Infinity */ |
75 #define DECFLOAT_MinSp 0x78000000 /* minimum special value */ | 76 #define DECFLOAT_MinSp 0x78000000 /* minimum special value */ |
76 /* [specials are all >=MinSp] */ | 77 /* [specials are all >=MinSp] */ |
77 /* Sign nibble constants */ | 78 /* Sign nibble constants */ |
78 #if !defined(DECPPLUSALT) | 79 #if !defined(DECPPLUSALT) |
79 #define DECPPLUSALT 0x0A /* alternate plus nibble */ | 80 #define DECPPLUSALT 0x0A /* alternate plus nibble */ |
80 #define DECPMINUSALT 0x0B /* alternate minus nibble */ | 81 #define DECPMINUSALT 0x0B /* alternate minus nibble */ |
81 #define DECPPLUS 0x0C /* preferred plus nibble */ | 82 #define DECPPLUS 0x0C /* preferred plus nibble */ |
82 #define DECPMINUS 0x0D /* preferred minus nibble */ | 83 #define DECPMINUS 0x0D /* preferred minus nibble */ |
83 #define DECPPLUSALT2 0x0E /* alternate plus nibble */ | 84 #define DECPPLUSALT2 0x0E /* alternate plus nibble */ |
84 #define DECPUNSIGNED 0x0F /* alternate plus nibble (unsigned) */ | 85 #define DECPUNSIGNED 0x0F /* alternate plus nibble (unsigned) */ |
85 #endif | 86 #endif |
86 | 87 |
87 /* ---------------------------------------------------------------- */ | 88 /* ---------------------------------------------------------------- */ |
88 /* Routines -- implemented as decFloat routines in common files */ | 89 /* Routines -- implemented as decFloat routines in common files */ |
89 /* ---------------------------------------------------------------- */ | 90 /* ---------------------------------------------------------------- */ |
92 | 93 |
93 /* Utilities and conversions, extractors, etc.) */ | 94 /* Utilities and conversions, extractors, etc.) */ |
94 extern decQuad * decQuadFromBCD(decQuad *, int32_t, const uint8_t *, int32_t); | 95 extern decQuad * decQuadFromBCD(decQuad *, int32_t, const uint8_t *, int32_t); |
95 extern decQuad * decQuadFromInt32(decQuad *, int32_t); | 96 extern decQuad * decQuadFromInt32(decQuad *, int32_t); |
96 extern decQuad * decQuadFromPacked(decQuad *, int32_t, const uint8_t *); | 97 extern decQuad * decQuadFromPacked(decQuad *, int32_t, const uint8_t *); |
98 extern decQuad * decQuadFromPackedChecked(decQuad *, int32_t, const uint8_t *); | |
97 extern decQuad * decQuadFromString(decQuad *, const char *, decContext *); | 99 extern decQuad * decQuadFromString(decQuad *, const char *, decContext *); |
98 extern decQuad * decQuadFromUInt32(decQuad *, uint32_t); | 100 extern decQuad * decQuadFromUInt32(decQuad *, uint32_t); |
99 extern int32_t decQuadGetCoefficient(const decQuad *, uint8_t *); | 101 extern int32_t decQuadGetCoefficient(const decQuad *, uint8_t *); |
100 extern int32_t decQuadGetExponent(const decQuad *); | 102 extern int32_t decQuadGetExponent(const decQuad *); |
101 extern decQuad * decQuadSetCoefficient(decQuad *, const uint8_t *, int32_t); | 103 extern decQuad * decQuadSetCoefficient(decQuad *, const uint8_t *, int32_t); |
175 extern uint32_t decQuadSameQuantum(const decQuad *, const decQuad *); | 177 extern uint32_t decQuadSameQuantum(const decQuad *, const decQuad *); |
176 extern const char * decQuadVersion(void); | 178 extern const char * decQuadVersion(void); |
177 | 179 |
178 /* decNumber conversions; these are implemented as macros so as not */ | 180 /* decNumber conversions; these are implemented as macros so as not */ |
179 /* to force a dependency on decimal128 and decNumber in decQuad. */ | 181 /* to force a dependency on decimal128 and decNumber in decQuad. */ |
182 /* decQuadFromNumber returns a decimal128 * to avoid warnings. */ | |
180 #define decQuadToNumber(dq, dn) decimal128ToNumber((decimal128 *)(dq), dn) | 183 #define decQuadToNumber(dq, dn) decimal128ToNumber((decimal128 *)(dq), dn) |
181 #define decQuadFromNumber(dq, dn, set) (decQuad *)decimal128FromNumber((decimal128 *)(dq), dn, set) | 184 #define decQuadFromNumber(dq, dn, set) decimal128FromNumber((decimal128 *)(dq), dn, set) |
182 | 185 |
183 #endif | 186 #endif |