1 /* Definitions of floating-point conversion from compiler
2 internal format to MPFR.
3 Copyright (C) 2010-2024 Free Software Foundation, Inc.
5 This file is part of GCC.
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
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
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/>. */
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
); }
34 operator mpfr_t
& () { return m_mpfr
; }
35 mpfr_ptr
operator-> () { return m_mpfr
; }
37 auto_mpfr (const auto_mpfr
&) = delete;
38 auto_mpfr
&operator= (const auto_mpfr
&) = delete;
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. */
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;
51 /* Convert between MPFR and REAL_VALUE_TYPE. The caller is
52 responsible for initializing and clearing the MPFR parameter. */
54 extern void real_from_mpfr (REAL_VALUE_TYPE
*, mpfr_srcptr
, tree
, mpfr_rnd_t
);
55 extern void real_from_mpfr (REAL_VALUE_TYPE
*, mpfr_srcptr
,
56 const real_format
*, mpfr_rnd_t
);
57 extern void mpfr_from_real (mpfr_ptr
, const REAL_VALUE_TYPE
*, mpfr_rnd_t
);
59 #endif /* ! GCC_REALGMP_H */