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/] [gcc-4.2.2/] [gcc/] [sreal.h] - Blame information for rev 285

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

Line No. Rev Author Line
1 38 julius
/* Definitions for simple data type for positive real numbers.
2
   Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
3
 
4
This file is part of GCC.
5
 
6
GCC is free software; you can redistribute it and/or modify it under
7
the terms of the GNU General Public License as published by the Free
8
Software Foundation; either version 3, or (at your option) any later
9
version.
10
 
11
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GCC; see the file COPYING3.  If not see
18
<http://www.gnu.org/licenses/>.  */
19
 
20
#ifndef GCC_SREAL_H
21
#define GCC_SREAL_H
22
 
23
/* SREAL_PART_BITS has to be an even number.  */
24
#if (HOST_BITS_PER_WIDE_INT / 2) % 2 == 1
25
#define SREAL_PART_BITS (HOST_BITS_PER_WIDE_INT / 2 - 1)
26
#else
27
#define SREAL_PART_BITS (HOST_BITS_PER_WIDE_INT / 2)
28
#endif
29
 
30
#define uhwi unsigned HOST_WIDE_INT
31
#define MAX_HOST_WIDE_INT (((uhwi) 1 << (HOST_BITS_PER_WIDE_INT - 1)) - 1)
32
 
33
#define SREAL_MIN_SIG ((uhwi) 1 << (SREAL_PART_BITS - 1))
34
#define SREAL_MAX_SIG (((uhwi) 1 << SREAL_PART_BITS) - 1)
35
#define SREAL_MAX_EXP (INT_MAX / 4)
36
 
37
#if SREAL_PART_BITS < 32
38
#define SREAL_BITS (SREAL_PART_BITS * 2)
39
#else
40
#define SREAL_BITS SREAL_PART_BITS
41
#endif
42
 
43
/* Structure for holding a simple real number.  */
44
typedef struct sreal
45
{
46
#if SREAL_PART_BITS < 32
47
  unsigned HOST_WIDE_INT sig_lo;        /* Significant (lower part).  */
48
  unsigned HOST_WIDE_INT sig_hi;        /* Significant (higher part).  */
49
#else
50
  unsigned HOST_WIDE_INT sig;           /* Significant.  */
51
#endif
52
  signed int exp;                       /* Exponent.  */
53
} sreal;
54
 
55
extern void dump_sreal (FILE *, sreal *);
56
extern sreal *sreal_init (sreal *, unsigned HOST_WIDE_INT, signed int);
57
extern HOST_WIDE_INT sreal_to_int (sreal *);
58
extern int sreal_compare (sreal *, sreal *);
59
extern sreal *sreal_add (sreal *, sreal *, sreal *);
60
extern sreal *sreal_sub (sreal *, sreal *, sreal *);
61
extern sreal *sreal_mul (sreal *, sreal *, sreal *);
62
extern sreal *sreal_div (sreal *, sreal *, sreal *);
63
 
64
#endif

powered by: WebSVN 2.1.0

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