OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [libdecnumber/] [decSingle.h] - Blame information for rev 309

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

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

powered by: WebSVN 2.1.0

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