gmpxxll.hpp#
long long support for mpz_class
. This file provides gmpxll::mpz_class
which inherits from the official mpz_class
and is binary compatible with it.
This makes it possible to mix the two types quite freely. So, you might want to use gmpxxll::mpz_class
where you perform (generic) conversion from/to standard integer types and use the regular mpz_class
everywhere else:
#include "gmpxxll/mpz_class.hpp"
mpz_class n;
gmpxxll::mpz_class m = std::limits<long long>::max;
// Since gmpxxll::mpz_class is derived from mpz_class, it casts implicitly into it:
n = m;
// Conversely, there are explicit conversions:
m = n;
m = gmpxxll::mpz_class(n);
-
class mpz_class : public mpz_class#
Adds long long functionality to
mpz_class
. This class derives from GMP’smpz_class
. It is binary compatible with that class but adds some methods related tolong long
andunsigned long / long
. Note that on LP64 implementations of C++ bothlong
andlong long
are 64 bits wide so this does not add anything and performance overhead should be negligible when optimizations are enabled. On LLP64 implementations, most notably Microsoft Windows, conversions actually need to take place. These conversions are probably not implemented very efficiently yet.mpz_class(…)
Construct an
mpz_class
from an (unsigned) long long value. All the constructors provided by GMP’smpz_class
are also available through a forwarding constructor.-
inline mpz_class(long long value)#
-
inline mpz_class(unsigned long long value)#
-
inline mpz_class(long long value)#