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