00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_GMP_Integer_inlines_hh
00025 #define PPL_GMP_Integer_inlines_hh 1
00026
00027 #include "assert.hh"
00028
00029 namespace Parma_Polyhedra_Library {
00030
00031 inline void
00032 neg_assign(GMP_Integer& x) {
00033 mpz_neg(x.get_mpz_t(), x.get_mpz_t());
00034 }
00035
00036 inline void
00037 neg_assign(GMP_Integer& x, const GMP_Integer& y) {
00038 mpz_neg(x.get_mpz_t(), y.get_mpz_t());
00039 }
00040
00041 inline void
00042 abs_assign(GMP_Integer& x) {
00043 mpz_abs(x.get_mpz_t(), x.get_mpz_t());
00044 }
00045
00046 inline void
00047 abs_assign(GMP_Integer& x, const GMP_Integer& y) {
00048 mpz_abs(x.get_mpz_t(), y.get_mpz_t());
00049 }
00050
00051 inline void
00052 gcd_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
00053 mpz_gcd(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00054 }
00055
00056 inline void
00057 rem_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
00058 mpz_tdiv_r(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00059 }
00060
00061 inline void
00062 gcdext_assign(GMP_Integer& x, GMP_Integer& s, GMP_Integer& t,
00063 const GMP_Integer& y, const GMP_Integer& z) {
00064 mpz_gcdext(x.get_mpz_t(),
00065 s.get_mpz_t(), t.get_mpz_t(),
00066 y.get_mpz_t(), z.get_mpz_t());
00067 }
00068
00069 inline void
00070 lcm_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
00071 mpz_lcm(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00072 }
00073
00074 inline void
00075 add_mul_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
00076 mpz_addmul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00077 }
00078
00079 inline void
00080 sub_mul_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
00081 mpz_submul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00082 }
00083
00084 inline void
00085 mul_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) {
00086 mpz_mul_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
00087 }
00088
00089 inline void
00090 div_2exp_assign(GMP_Integer& x, const GMP_Integer& y, unsigned int exp) {
00091 mpz_tdiv_q_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
00092 }
00093
00094 inline void
00095 exact_div_assign(GMP_Integer& x, const GMP_Integer& y, const GMP_Integer& z) {
00096 PPL_ASSERT(y % z == 0);
00097 mpz_divexact(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00098 }
00099
00100 inline void
00101 sqrt_assign(GMP_Integer& x, const GMP_Integer& y) {
00102 mpz_sqrt(x.get_mpz_t(), y.get_mpz_t());
00103 }
00104
00105 inline int
00106 cmp(const GMP_Integer& x, const GMP_Integer& y) {
00107 return mpz_cmp(x.get_mpz_t(), y.get_mpz_t());
00108 }
00109
00110 inline const mpz_class&
00111 raw_value(const GMP_Integer& x) {
00112 return x;
00113 }
00114
00115 inline mpz_class&
00116 raw_value(GMP_Integer& x) {
00117 return x;
00118 }
00119
00120 }
00121
00122 #endif // !defined(PPL_GMP_Integer_inlines_hh)