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