示例#1
0
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();
    }
示例#2
0
文件: merge_irep.cpp 项目: bkolb/cbmc
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());
  }
示例#3
0
文件: irep.cpp 项目: sarnold/cbmc
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());
  }
示例#4
0
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
  }