]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/realmpfr.h
Fix profiledbootstrap
[thirdparty/gcc.git] / gcc / realmpfr.h
CommitLineData
d49b6e1e
SB
1/* Definitions of floating-point conversion from compiler
2 internal format to MPFR.
aeee4812 3 Copyright (C) 2010-2023 Free Software Foundation, Inc.
d49b6e1e
SB
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 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_REALGMP_H
22#define GCC_REALGMP_H
23
d49b6e1e
SB
24#include <mpfr.h>
25#include <mpc.h>
d49b6e1e 26
278f8f56
RB
27class auto_mpfr
28{
29public:
30 auto_mpfr () { mpfr_init (m_mpfr); }
31 explicit auto_mpfr (mpfr_prec_t prec) { mpfr_init2 (m_mpfr, prec); }
32 ~auto_mpfr () { mpfr_clear (m_mpfr); }
33
34 operator mpfr_t& () { return m_mpfr; }
210617b5 35 mpfr_ptr operator-> () { return m_mpfr; }
278f8f56
RB
36
37 auto_mpfr (const auto_mpfr &) = delete;
38 auto_mpfr &operator= (const auto_mpfr &) = delete;
39
195270d2
JJ
40#if GCC_VERSION < 4008 || GCC_VERSION >= 5000
41 /* GCC 4.8 and 4.9 don't support this, only fixed in PR62101 for 5.0. */
278f8f56
RB
42 friend void mpfr_clear (auto_mpfr&) = delete;
43 friend void mpfr_init (auto_mpfr&) = delete;
44 friend void mpfr_init2 (auto_mpfr&, mpfr_prec_t) = delete;
195270d2 45#endif
278f8f56
RB
46
47private:
48 mpfr_t m_mpfr;
49};
50
d49b6e1e
SB
51/* Convert between MPFR and REAL_VALUE_TYPE. The caller is
52 responsible for initializing and clearing the MPFR parameter. */
53
90ca6847 54extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, tree, mpfr_rnd_t);
5c1a2e63 55extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr,
90ca6847
TB
56 const real_format *, mpfr_rnd_t);
57extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *, mpfr_rnd_t);
d49b6e1e 58
89dc4c94 59#endif /* ! GCC_REALGMP_H */