]> git.ipfire.org Git - thirdparty/gcc.git/blame - libdecnumber/decSingle.h
* omp-low.c (lower_rec_input_clauses): Handle references properly
[thirdparty/gcc.git] / libdecnumber / decSingle.h
CommitLineData
c8ac5d9a 1/* decSingle module header for the decNumber C Library.
fbd26352 2 Copyright (C) 2005-2019 Free Software Foundation, Inc.
c8ac5d9a 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
6bc9506f 9 Software Foundation; either version 3, or (at your option) any later
c8ac5d9a 10 version.
11
c8ac5d9a 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
6bc9506f 17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
c8ac5d9a 25
26/* ------------------------------------------------------------------ */
27/* decSingle.h -- Decimal 32-bit format module header */
28/* ------------------------------------------------------------------ */
c8ac5d9a 29
30#if !defined(DECSINGLE)
31 #define DECSINGLE
32
f3b943d0 33 #define DECSINGLENAME "decSingle" /* Short name */
c8ac5d9a 34 #define DECSINGLETITLE "Decimal 32-bit datum" /* Verbose name */
35 #define DECSINGLEAUTHOR "Mike Cowlishaw" /* Who to blame */
36
37 /* parameters for decSingles */
38 #define DECSINGLE_Bytes 4 /* length */
39 #define DECSINGLE_Pmax 7 /* maximum precision (digits) */
f3b943d0 40 #define DECSINGLE_Emin -95 /* minimum adjusted exponent */
41 #define DECSINGLE_Emax 96 /* maximum adjusted exponent */
c8ac5d9a 42 #define DECSINGLE_EmaxD 3 /* maximum exponent digits */
43 #define DECSINGLE_Bias 101 /* bias for the exponent */
f3b943d0 44 #define DECSINGLE_String 16 /* maximum string length, +1 */
c8ac5d9a 45 #define DECSINGLE_EconL 6 /* exponent continuation length */
46 #define DECSINGLE_Declets 2 /* count of declets */
47 /* highest biased exponent (Elimit-1) */
48 #define DECSINGLE_Ehigh (DECSINGLE_Emax + DECSINGLE_Bias - (DECSINGLE_Pmax-1))
49
50 /* Required includes */
51 #include "decContext.h"
52 #include "decQuad.h"
53 #include "decDouble.h"
54
f3b943d0 55 /* The decSingle decimal 32-bit type, accessible by all sizes */
67da83cb 56 typedef union {
f3b943d0 57 uint8_t bytes[DECSINGLE_Bytes]; /* fields: 1, 5, 6, 20 bits */
67da83cb 58 uint16_t shorts[DECSINGLE_Bytes/2];
f3b943d0 59 uint32_t words[DECSINGLE_Bytes/4];
c8ac5d9a 60 } decSingle;
61
62 /* ---------------------------------------------------------------- */
63 /* Routines -- implemented as decFloat routines in common files */
64 /* ---------------------------------------------------------------- */
65
66 #include "decSingleSymbols.h"
67
68 /* Utilities (binary argument(s) or result, extractors, etc.) */
69 extern decSingle * decSingleFromBCD(decSingle *, int32_t, const uint8_t *, int32_t);
70 extern decSingle * decSingleFromPacked(decSingle *, int32_t, const uint8_t *);
f3b943d0 71 extern decSingle * decSingleFromPackedChecked(decSingle *, int32_t, const uint8_t *);
c8ac5d9a 72 extern decSingle * decSingleFromString(decSingle *, const char *, decContext *);
73 extern decSingle * decSingleFromWider(decSingle *, const decDouble *, decContext *);
74 extern int32_t decSingleGetCoefficient(const decSingle *, uint8_t *);
75 extern int32_t decSingleGetExponent(const decSingle *);
76 extern decSingle * decSingleSetCoefficient(decSingle *, const uint8_t *, int32_t);
77 extern decSingle * decSingleSetExponent(decSingle *, decContext *, int32_t);
78 extern void decSingleShow(const decSingle *, const char *);
79 extern int32_t decSingleToBCD(const decSingle *, int32_t *, uint8_t *);
80 extern char * decSingleToEngString(const decSingle *, char *);
81 extern int32_t decSingleToPacked(const decSingle *, int32_t *, uint8_t *);
82 extern char * decSingleToString(const decSingle *, char *);
83 extern decDouble * decSingleToWider(const decSingle *, decDouble *);
84 extern decSingle * decSingleZero(decSingle *);
85
86 /* (No Arithmetic routines for decSingle) */
87
88 /* Non-computational */
89 extern uint32_t decSingleRadix(const decSingle *);
90 extern const char * decSingleVersion(void);
91
92 /* decNumber conversions; these are implemented as macros so as not */
93 /* to force a dependency on decimal32 and decNumber in decSingle. */
f3b943d0 94 /* decSingleFromNumber returns a decimal32 * to avoid warnings. */
c8ac5d9a 95 #define decSingleToNumber(dq, dn) decimal32ToNumber((decimal32 *)(dq), dn)
f3b943d0 96 #define decSingleFromNumber(dq, dn, set) decimal32FromNumber((decimal32 *)(dq), dn, set)
c8ac5d9a 97
98#endif