Integer(const Integer& q) : d_value(q.d_value) {}
- Integer( signed int z) : d_value(z) {}
- Integer(unsigned int z) : d_value(z) {}
+ Integer( signed int z) : d_value((signed long int)z) {}
+ Integer(unsigned int z) : d_value((unsigned long int)z) {}
Integer( signed long int z) : d_value(z) {}
Integer(unsigned long int z) : d_value(z) {}
return *this;
}
- /*
- Integer operator/(const Integer& y) const {
- return Integer( cln::floor1(d_value, y.d_value) );
- }
- Integer& operator/=(const Integer& y) {
- d_value = cln::floor1(d_value, y.d_value);
- return *this;
- }
-
- Integer operator%(const Integer& y) const {
- return Integer( cln::floor2(d_value, y.d_value).remainder );
- }
- Integer& operator%=(const Integer& y) {
- d_value = cln::floor2(d_value, y.d_value).remainder;
- return *this;
- }
- */
-
Integer bitwiseOr(const Integer& y) const {
- return Integer(cln::logior(d_value, y.d_value));
+ return Integer(cln::logior(d_value, y.d_value));
}
Integer bitwiseAnd(const Integer& y) const {
- return Integer(cln::logand(d_value, y.d_value));
+ return Integer(cln::logand(d_value, y.d_value));
}
Integer bitwiseXor(const Integer& y) const {
- return Integer(cln::logxor(d_value, y.d_value));
+ return Integer(cln::logxor(d_value, y.d_value));
}
Integer bitwiseNot() const {
return d_value == -1;
}
- //friend std::ostream& operator<<(std::ostream& os, const Integer& n);
-
long getLong() const {
// ensure there isn't overflow
CheckArgument(d_value <= std::numeric_limits<long>::max(), this,
*/
unsigned isPow2() const {
if (d_value <= 0) return 0;
- // power2p returns n such that d_value = 2^(n-1)
+ // power2p returns n such that d_value = 2^(n-1)
return cln::power2p(d_value);
}
/**
* Constructs a canonical Rational from a numerator.
*/
- Rational(signed int n) : d_value(n) { }
- Rational(unsigned int n) : d_value(n) { }
+ Rational(signed int n) : d_value((signed long int)n) { }
+ Rational(unsigned int n) : d_value((unsigned long int)n) { }
Rational(signed long int n) : d_value(n) { }
Rational(unsigned long int n) : d_value(n) { }
/**
* Constructs a canonical Rational from a numerator and denominator.
*/
- Rational(signed int n, signed int d) : d_value(n) {
+ Rational(signed int n, signed int d) : d_value((signed long int)n) {
d_value /= d;
}
- Rational(unsigned int n, unsigned int d) : d_value(n) {
+ Rational(unsigned int n, unsigned int d) : d_value((unsigned long int)n) {
d_value /= d;
}
Rational(signed long int n, signed long int d) : d_value(n) {