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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libdecnumber/] [dpd/] [decimal32.h] - Blame information for rev 731

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 731 jeremybenn
/* Decimal 32-bit format module header for the decNumber C Library.
2
   Copyright (C) 2005, 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
/* Decimal 32-bit format module header                                */
28
/* ------------------------------------------------------------------ */
29
 
30
#if !defined(DECIMAL32)
31
  #define DECIMAL32
32
  #define DEC32NAME     "decimal32"                   /* Short name   */
33
  #define DEC32FULLNAME "Decimal 32-bit Number"       /* Verbose name */
34
  #define DEC32AUTHOR   "Mike Cowlishaw"              /* Who to blame */
35
 
36
  /* parameters for decimal32s */
37
  #define DECIMAL32_Bytes  4            /* length                     */
38
  #define DECIMAL32_Pmax   7            /* maximum precision (digits) */
39
  #define DECIMAL32_Emax   96           /* maximum adjusted exponent  */
40
  #define DECIMAL32_Emin  -95           /* minimum adjusted exponent  */
41
  #define DECIMAL32_Bias   101          /* bias for the exponent      */
42
  #define DECIMAL32_String 15           /* maximum string length, +1  */
43
  #define DECIMAL32_EconL  6            /* exp. continuation length   */
44
  /* highest biased exponent (Elimit-1)                               */
45
  #define DECIMAL32_Ehigh  (DECIMAL32_Emax+DECIMAL32_Bias-DECIMAL32_Pmax+1)
46
 
47
  /* check enough digits, if pre-defined                              */
48
  #if defined(DECNUMDIGITS)
49
    #if (DECNUMDIGITS<DECIMAL32_Pmax)
50
      #error decimal32.h needs pre-defined DECNUMDIGITS>=7 for safe use
51
    #endif
52
  #endif
53
 
54
  #ifndef DECNUMDIGITS
55
    #define DECNUMDIGITS DECIMAL32_Pmax /* size if not already defined*/
56
  #endif
57
  #ifndef DECNUMBER
58
    #include "decNumber.h"              /* context and number library */
59
  #endif
60
 
61
  /* Decimal 32-bit type, accessible by bytes */
62
  typedef struct {
63
    uint8_t bytes[DECIMAL32_Bytes];     /* decimal32: 1, 5, 6, 20 bits*/
64
    } decimal32;
65
 
66
  /* special values [top byte excluding sign bit; last two bits are   */
67
  /* don't-care for Infinity on input, last bit don't-care for NaN]   */
68
  #if !defined(DECIMAL_NaN)
69
    #define DECIMAL_NaN     0x7c        /* 0 11111 00 NaN             */
70
    #define DECIMAL_sNaN    0x7e        /* 0 11111 10 sNaN            */
71
    #define DECIMAL_Inf     0x78        /* 0 11110 00 Infinity        */
72
  #endif
73
 
74
  /* ---------------------------------------------------------------- */
75
  /* Routines                                                         */
76
  /* ---------------------------------------------------------------- */
77
 
78
#include "decimal32Symbols.h"
79
 
80
  #ifdef __cplusplus
81
  extern "C" {
82
  #endif
83
 
84
  /* String conversions                                               */
85
  decimal32 * decimal32FromString(decimal32 *, const char *, decContext *);
86
  char * decimal32ToString(const decimal32 *, char *);
87
  char * decimal32ToEngString(const decimal32 *, char *);
88
 
89
  /* decNumber conversions                                            */
90
  decimal32 * decimal32FromNumber(decimal32 *, const decNumber *,
91
                                  decContext *);
92
  decNumber * decimal32ToNumber(const decimal32 *, decNumber *);
93
 
94
  /* Format-dependent utilities                                       */
95
  uint32_t    decimal32IsCanonical(const decimal32 *);
96
  decimal32 * decimal32Canonical(decimal32 *, const decimal32 *);
97
 
98
  #ifdef __cplusplus
99
  }
100
  #endif
101
 
102
#endif

powered by: WebSVN 2.1.0

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