text: Q:
  
  Struct to store records from /proc//maps
  
  I use the next struct to store information from /proc//maps:
  typedef struct
  {
      unsigned long vm_start;
      unsigned long vm_end;
      unsigned long vm_flags;
      unsigned long vm_pgoff;
      dev_t vm_dev;
      unsigned long vm_ino;
      unsigned long vm_size;
      int vm_shares;
  } map_t;
  
  And a vector:
  
  typedef struct
  {
      map_t *arr;
      int size;
      int reserved;
  } map_vector_t;
  
  When I read a record from file, I find a shared equivalent region:
  
  int index = mem_mapping_find_shared(vector, map);
  if (index != -1) {
      vector->arr[index].vm_shares++;
      continue;
  }
  
  map.vm_shares = 0;
  
  int mem_mapping_find_shared(map_vector_t *vector, map_t map)
  {
      int index = -1;
  
      for (int i = 0; index == -1 && i < vector->size; i++) {
          if (mem_mapping_is_shareable(vector->arr[i], map)) {
              index = i;
          }
      }
  
      return index;
  }
  
  But it's too slow code. I think I should use hash table, right? Which hash function I can use?
  
  A:
  
  Maybe it will be useful for someone:
  
  unsigned long long mem_mapping_hash(const map_t *map)
  {
      unsigned long long h = map->vm_pgoff;
      h = h * PRIME + map->vm_dev;
      h = h * PRIME + map->vm_ino;
      h = h * PRIME + map->vm_size;
  
      return h % PRIME;
  }
  
  