Mercurial > hg > CbC > CbC_gcc
comparison libdecnumber/decSingle.h @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children | 77e2b8dfacca |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
1 /* decSingle module header for the decNumber C Library. | |
2 Copyright (C) 2005, 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 /* decSingle.h -- Decimal 32-bit format module header */ | |
28 /* ------------------------------------------------------------------ */ | |
29 /* Please see decFloats.h for an overview and documentation details. */ | |
30 /* ------------------------------------------------------------------ */ | |
31 | |
32 #if !defined(DECSINGLE) | |
33 #define DECSINGLE | |
34 | |
35 #define DECSINGLENAME "decSingle" /* Short name */ | |
36 #define DECSINGLETITLE "Decimal 32-bit datum" /* Verbose name */ | |
37 #define DECSINGLEAUTHOR "Mike Cowlishaw" /* Who to blame */ | |
38 | |
39 /* parameters for decSingles */ | |
40 #define DECSINGLE_Bytes 4 /* length */ | |
41 #define DECSINGLE_Pmax 7 /* maximum precision (digits) */ | |
42 #define DECSINGLE_Emin -95 /* minimum adjusted exponent */ | |
43 #define DECSINGLE_Emax 96 /* maximum adjusted exponent */ | |
44 #define DECSINGLE_EmaxD 3 /* maximum exponent digits */ | |
45 #define DECSINGLE_Bias 101 /* bias for the exponent */ | |
46 #define DECSINGLE_String 16 /* maximum string length, +1 */ | |
47 #define DECSINGLE_EconL 6 /* exponent continuation length */ | |
48 #define DECSINGLE_Declets 2 /* count of declets */ | |
49 /* highest biased exponent (Elimit-1) */ | |
50 #define DECSINGLE_Ehigh (DECSINGLE_Emax + DECSINGLE_Bias - (DECSINGLE_Pmax-1)) | |
51 | |
52 /* Required includes */ | |
53 #include "decContext.h" | |
54 #include "decQuad.h" | |
55 #include "decDouble.h" | |
56 | |
57 /* The decSingle decimal 32-bit type, accessible by various types */ | |
58 typedef union { | |
59 uint8_t bytes[DECSINGLE_Bytes]; /* fields: 1, 5, 6, 20 bits */ | |
60 uint16_t shorts[DECSINGLE_Bytes/2]; | |
61 uint32_t words[DECSINGLE_Bytes/4]; | |
62 } decSingle; | |
63 | |
64 /* ---------------------------------------------------------------- */ | |
65 /* Routines -- implemented as decFloat routines in common files */ | |
66 /* ---------------------------------------------------------------- */ | |
67 | |
68 #include "decSingleSymbols.h" | |
69 | |
70 /* Utilities (binary argument(s) or result, extractors, etc.) */ | |
71 extern decSingle * decSingleFromBCD(decSingle *, int32_t, const uint8_t *, int32_t); | |
72 extern decSingle * decSingleFromPacked(decSingle *, int32_t, const uint8_t *); | |
73 extern decSingle * decSingleFromString(decSingle *, const char *, decContext *); | |
74 extern decSingle * decSingleFromWider(decSingle *, const decDouble *, decContext *); | |
75 extern int32_t decSingleGetCoefficient(const decSingle *, uint8_t *); | |
76 extern int32_t decSingleGetExponent(const decSingle *); | |
77 extern decSingle * decSingleSetCoefficient(decSingle *, const uint8_t *, int32_t); | |
78 extern decSingle * decSingleSetExponent(decSingle *, decContext *, int32_t); | |
79 extern void decSingleShow(const decSingle *, const char *); | |
80 extern int32_t decSingleToBCD(const decSingle *, int32_t *, uint8_t *); | |
81 extern char * decSingleToEngString(const decSingle *, char *); | |
82 extern int32_t decSingleToPacked(const decSingle *, int32_t *, uint8_t *); | |
83 extern char * decSingleToString(const decSingle *, char *); | |
84 extern decDouble * decSingleToWider(const decSingle *, decDouble *); | |
85 extern decSingle * decSingleZero(decSingle *); | |
86 | |
87 /* (No Arithmetic routines for decSingle) */ | |
88 | |
89 /* Non-computational */ | |
90 extern uint32_t decSingleRadix(const decSingle *); | |
91 extern const char * decSingleVersion(void); | |
92 | |
93 /* decNumber conversions; these are implemented as macros so as not */ | |
94 /* to force a dependency on decimal32 and decNumber in decSingle. */ | |
95 #define decSingleToNumber(dq, dn) decimal32ToNumber((decimal32 *)(dq), dn) | |
96 #define decSingleFromNumber(dq, dn, set) (decSingle *)decimal32FromNumber((decimal32 *)(dq), dn, set) | |
97 | |
98 #endif |