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.
This commit is contained in:
Laurent Rineau 2021-03-17 11:28:07 +01:00
parent 1442c769c7
commit 20dc974594
1 changed files with 14 additions and 0 deletions

View File

@ -10,6 +10,8 @@
//
// Author(s) : Marc Glisse
//#define CGAL_MPZF_DIVISION_OPERATOR 1
#ifndef CGAL_MPZF_H
#define CGAL_MPZF_H
#include <cstdlib>
@ -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
}
};