/********************* */ /** integer.h ** Original author: taking ** Major contributors: none ** Minor contributors (to current version): none ** This file is part of the CVC4 prototype. ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys) ** Courant Institute of Mathematical Sciences ** New York University ** See the file COPYING in the top-level source directory for licensing ** information. ** ** A multiprecision integer constant. **/ #ifndef __CVC4__INTEGER_H #define __CVC4__INTEGER_H #include #include namespace CVC4 { /** Hashes the gmp integer primitive in a word by word fashion. */ inline size_t gmpz_hash(const mpz_t toHash){ size_t hash = 0; for (int i=0, n=mpz_size(toHash); i (const Integer& y) const { return d_value > y.d_value; } bool operator>=(const Integer& y) const { return d_value >= y.d_value; } Integer operator+(const Integer& y) const{ return Integer( d_value + y.d_value ); } Integer operator-(const Integer& y) const { return Integer( d_value - y.d_value ); } Integer operator*(const Integer& y) const { return Integer( d_value * y.d_value ); } Integer operator/(const Integer& y) const { return Integer( d_value / y.d_value ); } std::string toString(int base = 10) const{ return d_value.get_str(base); } //friend std::ostream& operator<<(std::ostream& os, const Integer& n); long getLong() const { return d_value.get_si(); } unsigned long getUnsignedLong() const {return d_value.get_ui(); } /** * Computes the hash of the node from the first word of the * numerator, the denominator. */ size_t hash() const { return gmpz_hash(d_value.get_mpz_t()); } friend class CVC4::Rational; };/* class Integer */ struct IntegerHashFcn { static inline size_t hash(const CVC4::Integer& i) { return i.hash(); } }; std::ostream& operator<<(std::ostream& os, const Integer& n); }/* CVC4 namespace */ #endif /* __CVC4__INTEGER_H */