mirror of https://github.com/CGAL/cgal
On win64, eigen wants to convert __int64 to whatever number type we are using.
This commit is contained in:
parent
39f1c4f589
commit
5c7ca614bf
|
|
@ -95,6 +95,35 @@ public:
|
|||
Gmpq(unsigned long n)
|
||||
{ mpq_set_ui(mpq(), n, 1); }
|
||||
|
||||
private:
|
||||
void init_ull(unsigned long long n){
|
||||
CGAL_assertion(sizeof(long)==4 && sizeof(long long)==8);
|
||||
mpq_set_ui(mpq(), (unsigned long)(n>>32), 1);
|
||||
mpz_ptr z = mpq_numref(mpq());
|
||||
mpz_mul_2exp (z, z, 32);
|
||||
mpz_add_ui (z, z, (unsigned long)n);
|
||||
}
|
||||
public:
|
||||
Gmpq(unsigned long long n)
|
||||
{
|
||||
if (n <= std::numeric_limits<unsigned long>::max())
|
||||
mpq_set_ui(mpq(), (unsigned long)n, 1);
|
||||
else
|
||||
init_ull(n);
|
||||
}
|
||||
|
||||
Gmpq(long long n)
|
||||
{
|
||||
if (sizeof(long)==sizeof(long long))
|
||||
mpq_set_si(mpq(), n, 1);
|
||||
else if (n>=0)
|
||||
init_ull(n);
|
||||
else {
|
||||
init_ull(-(unsigned long long)n);
|
||||
mpq_neg(mpq(), mpq());
|
||||
}
|
||||
}
|
||||
|
||||
Gmpq(const Gmpz& n)
|
||||
{ mpq_set_z(mpq(), n.mpz()); }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue