From 20dc97459475ce757597a4431b13e217dfb0a62c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 17 Mar 2021 11:28:07 +0100 Subject: [PATCH] Remove operator/ from CGAL::Mpzf The operator `operator/(Mpfz,Mpfz)` actually implements integral division. With this commit, it is renamed `division((Mpfz,Mpfz)` unless the macro `CGAL_MPZF_DIVISION_OPERATOR` is defined. I have commented the line #define CGAL_MPZF_DIVISION_OPERATOR 1 and that will breaks a lot of CGAL code in this branch. --- Number_types/include/CGAL/Mpzf.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Number_types/include/CGAL/Mpzf.h b/Number_types/include/CGAL/Mpzf.h index 6e482232df0..f850010b90b 100644 --- a/Number_types/include/CGAL/Mpzf.h +++ b/Number_types/include/CGAL/Mpzf.h @@ -10,6 +10,8 @@ // // Author(s) : Marc Glisse +//#define CGAL_MPZF_DIVISION_OPERATOR 1 + #ifndef CGAL_MPZF_H #define CGAL_MPZF_H #include @@ -774,7 +776,11 @@ struct Mpzf { return res; } +#ifndef CGAL_MPZF_DIVISION_OPERATOR + friend Mpzf division(Mpzf const&a, Mpzf const&b){ +#else // CGAL_MPZF_DIVISION_OPERATOR friend Mpzf operator/(Mpzf const&a, Mpzf const&b){ +#endif // CGAL_MPZF_DIVISION_OPERATOR // FIXME: Untested int asize=std::abs(a.size); int bsize=std::abs(b.size); @@ -909,7 +915,11 @@ struct Mpzf { Mpzf& operator+=(Mpzf const&x){ *this=*this+x; return *this; } Mpzf& operator-=(Mpzf const&x){ *this=*this-x; return *this; } Mpzf& operator*=(Mpzf const&x){ *this=*this*x; return *this; } +#ifdef CGAL_MPZF_DIVISION_OPERATOR Mpzf& operator/=(Mpzf const&x){ *this=*this/x; return *this; } +#else // not CGAL_MPZF_DIVISION_OPERATOR + Mpzf& operator/=(Mpzf const&x){ *this=division(*this,x); return *this; } +#endif // not CGAL_MPZF_DIVISION_OPERATOR bool is_canonical () const { if (size == 0) return true; @@ -1096,7 +1106,11 @@ std::istream& operator>> (std::istream& is, Mpzf& a) Type operator()( const Type& x, const Type& y ) const { +#ifdef CGAL_MPZF_DIVISION_OPERATOR return x / y; +#else // not CGAL_MPZF_DIVISION_OPERATOR + return division(x, y); +#endif // not CGAL_MPZF_DIVISION_OPERATOR } };