size_t irept::hash() const { size_t result=hash_string(id()); forall_irep(it, get_sub()) result=result^it->hash(); forall_named_irep(it, get_named_sub()) { result=result^hash_string(it->first); result=result^it->second.hash(); }
std::size_t to_be_merged_irept::hash() const { std::size_t result=hash_string(id()); const irept::subt &sub=get_sub(); const irept::named_subt &named_sub=get_named_sub(); forall_irep(it, sub) result=hash_combine(result, static_cast<const merged_irept &>(*it).hash()); forall_named_irep(it, named_sub) { result=hash_combine(result, hash_string(it->first)); result=hash_combine(result, static_cast<const merged_irept &>(it->second).hash()); }
std::size_t irept::hash() const { #ifdef HASH_CODE if(read().hash_code!=0) return read().hash_code; #endif const irept::subt &sub=get_sub(); const irept::named_subt &named_sub=get_named_sub(); std::size_t result=hash_string(id()); forall_irep(it, sub) result=hash_combine(result, it->hash()); forall_named_irep(it, named_sub) { result=hash_combine(result, hash_string(it->first)); result=hash_combine(result, it->second.hash()); }
void irep_hash_container_baset::pack( const irept &irep, packedt &packed) { const irept::subt &sub=irep.get_sub(); const irept::named_subt &named_sub=irep.get_named_sub(); const irept::named_subt &comments=irep.get_comments(); packed.reserve( 1+1+sub.size()+named_sub.size()*2+ (full?comments.size()*2:0)); packed.push_back(irep_id_hash()(irep.id())); packed.push_back(sub.size()); forall_irep(it, sub) packed.push_back(number(*it)); packed.push_back(named_sub.size()); forall_named_irep(it, named_sub) { packed.push_back(irep_id_hash()(it->first)); // id packed.push_back(number(it->second)); // sub-irep }