PPL  1.2
GMP_Integer_inlines.hh
Go to the documentation of this file.
1 /* GMP_Integer class implementation: inline functions.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY 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 this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_GMP_Integer_inlines_hh
25 #define PPL_GMP_Integer_inlines_hh 1
26 
27 #include "assertions.hh"
28 
29 namespace Parma_Polyhedra_Library {
30 
31 inline void
33  mpz_neg(x.get_mpz_t(), x.get_mpz_t());
34 }
35 
36 inline void
38  mpz_neg(x.get_mpz_t(), y.get_mpz_t());
39 }
40 
41 inline void
43  mpz_abs(x.get_mpz_t(), x.get_mpz_t());
44 }
45 
46 inline void
48  mpz_abs(x.get_mpz_t(), y.get_mpz_t());
49 }
50 
51 inline void
52 gcd_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
53  mpz_gcd(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
54 }
55 
56 inline void
57 rem_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
58  mpz_tdiv_r(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
59 }
60 
61 inline void
63  const GMP_Integer& y, const GMP_Integer& z) {
64  mpz_gcdext(x.get_mpz_t(),
65  s.get_mpz_t(), t.get_mpz_t(),
66  y.get_mpz_t(), z.get_mpz_t());
67 }
68 
69 inline void
70 lcm_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
71  mpz_lcm(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
72 }
73 
74 inline void
76  mpz_addmul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
77 }
78 
79 inline void
81  mpz_submul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
82 }
83 
84 inline void
85 mul_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) {
86  mpz_mul_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
87 }
88 
89 inline void
90 div_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) {
91  mpz_tdiv_q_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
92 }
93 
94 inline void
96  PPL_ASSERT(y % z == 0);
97  mpz_divexact(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
98 }
99 
100 inline void
102  mpz_sqrt(x.get_mpz_t(), y.get_mpz_t());
103 }
104 
105 inline int
106 cmp(const GMP_Integer& x, const GMP_Integer& y) {
107  return mpz_cmp(x.get_mpz_t(), y.get_mpz_t());
108 }
109 
110 inline const mpz_class&
112  return x;
113 }
114 
115 inline mpz_class&
117  return x;
118 }
119 
120 } // namespace Parma_Polyhedra_Library
121 
122 #endif // !defined(PPL_GMP_Integer_inlines_hh)
void add_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
void abs_assign(GMP_Integer &x)
void lcm_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
void sqrt_assign(GMP_Integer &x, const GMP_Integer &y)
void exact_div_assign(Checked_Number< T, Policy > &x, const Checked_Number< T, Policy > &y, const Checked_Number< T, Policy > &z)
void div_2exp_assign(GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
const mpz_class & raw_value(const GMP_Integer &x)
void gcdext_assign(GMP_Integer &x, GMP_Integer &s, GMP_Integer &t, const GMP_Integer &y, const GMP_Integer &z)
void rem_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
void mul_2exp_assign(GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
Unbounded integers as provided by the GMP library.
void neg_assign(GMP_Integer &x)
The entire library is confined to this namespace.
Definition: version.hh:61
int cmp(const GMP_Integer &x, const GMP_Integer &y)
void gcd_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
void sub_mul_assign(GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)