From c96d62d41a178e0f524c39a0f73da9b7730dcf0b Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Mon, 22 Feb 2010 19:22:56 +0000 Subject: undoing improperly-committed revision 232; will re-commit to get "svn blame" correct, etc.. --- src/expr/attribute.h | 54 ++++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 31 deletions(-) (limited to 'src/expr/attribute.h') diff --git a/src/expr/attribute.h b/src/expr/attribute.h index 1d2705240..12de9eb5f 100644 --- a/src/expr/attribute.h +++ b/src/expr/attribute.h @@ -56,7 +56,7 @@ namespace expr { struct AttrHashFcn { enum { LARGE_PRIME = 1 }; - std::size_t operator()(const std::pair& p) const { + std::size_t operator()(const std::pair& p) const { return p.first * LARGE_PRIME + p.second.hash(); } }; @@ -122,7 +122,7 @@ struct KindTableMapping { // use a TAG to indicate which table it should be in template -struct AttrHash : public __gnu_cxx::hash_map, value_type, AttrHashFcn> {}; +struct AttrHash : public __gnu_cxx::hash_map, value_type, AttrHashFcn> {}; template <> class AttrHash : protected __gnu_cxx::hash_map { @@ -215,23 +215,19 @@ class AttrHash : protected __gnu_cxx::hash_map key_type; + typedef std::pair key_type; typedef bool data_type; typedef std::pair value_type; typedef BitIterator iterator; typedef ConstBitIterator const_iterator; - BitIterator find(const std::pair& k) { + BitIterator find(const std::pair& k) { super::iterator i = super::find(k.second); if(i == super::end()) { return BitIterator(); } - Debug.printf("boolattr", - "underlying word at 0x%p looks like 0x%016llx, bit is %u\n", - &(*i).second, - (unsigned long long)((*i).second), - unsigned(k.first)); + Debug.printf("boolattr", "underlying word at 0x%p looks like 0x%016llx, bit is %u\n", &(*i).second, (*i).second, k.first); return BitIterator(*i, k.first); } @@ -239,16 +235,12 @@ public: return BitIterator(); } - ConstBitIterator find(const std::pair& k) const { + ConstBitIterator find(const std::pair& k) const { super::const_iterator i = super::find(k.second); if(i == super::end()) { return ConstBitIterator(); } - Debug.printf("boolattr", - "underlying word at 0x%p looks like 0x%016llx, bit is %u\n", - &(*i).second, - (unsigned long long)((*i).second), - unsigned(k.first)); + Debug.printf("boolattr", "underlying word at 0x%p looks like 0x%016llx, bit is %u\n", &(*i).second, (*i).second, k.first); return ConstBitIterator(*i, k.first); } @@ -256,7 +248,7 @@ public: return ConstBitIterator(); } - BitAccessor operator[](const std::pair& k) { + BitAccessor operator[](const std::pair& k) { uint64_t& word = super::operator[](k.second); return BitAccessor(word, k.first); } @@ -276,18 +268,18 @@ struct Attribute { /** cleanup routine when the Node goes away */ static inline void cleanup(const value_t&) {} - static inline uint64_t getId() { return s_id; } - static inline uint64_t getHashValue() { return s_hashValue; } + static inline unsigned getId() { return s_id; } + static inline unsigned getHashValue() { return s_hashValue; } static const bool has_default_value = false; private: /** an id */ - static const uint64_t s_id; + static const unsigned s_id; /** an extra hash value (to avoid same-value-type collisions) */ - static const uint64_t s_hashValue; + static const unsigned s_hashValue; }; /** @@ -302,13 +294,13 @@ struct Attribute { /** cleanup routine when the Node goes away */ static inline void cleanup(const bool&) {} - static inline uint64_t getId() { return s_id; } - static inline uint64_t getHashValue() { return s_hashValue; } + static inline unsigned getId() { return s_id; } + static inline unsigned getHashValue() { return s_hashValue; } static const bool has_default_value = true; static const bool default_value = false; - static inline uint64_t checkID(uint64_t id) { + static inline unsigned checkID(unsigned id) { AlwaysAssert(id <= 63, "Too many boolean node attributes registered during initialization !"); return id; @@ -317,10 +309,10 @@ struct Attribute { private: /** a bit assignment */ - static const uint64_t s_id; + static const unsigned s_id; /** an extra hash value (to avoid same-value-type collisions) */ - static const uint64_t s_hashValue; + static const unsigned s_hashValue; }; // SPECIFIC, GLOBAL ATTRIBUTE DEFINITIONS ====================================== @@ -331,11 +323,11 @@ namespace attr { template struct LastAttributeId { - static uint64_t s_id; + static unsigned s_id; }; template - uint64_t LastAttributeId::s_id = 0; + unsigned LastAttributeId::s_id = 0; }/* CVC4::expr::attr namespace */ typedef Attribute VarNameAttr; @@ -344,16 +336,16 @@ typedef Attribute TypeAttr; // ATTRIBUTE IDENTIFIER ASSIGNMENT ============================================= template -const uint64_t Attribute::s_id = +const unsigned Attribute::s_id = attr::LastAttributeId::table_value_type>::s_id++; template -const uint64_t Attribute::s_hashValue = Attribute::s_id; +const unsigned Attribute::s_hashValue = Attribute::s_id; template -const uint64_t Attribute::s_id = +const unsigned Attribute::s_id = Attribute::checkID(attr::LastAttributeId::s_id++); template -const uint64_t Attribute::s_hashValue = Attribute::s_id; +const unsigned Attribute::s_hashValue = Attribute::s_id; class AttributeManager; -- cgit v1.2.3