patch-freehdl_kernel-list_hh 542 B

12345678910111213141516
  1. $OpenBSD: patch-freehdl_kernel-list_hh,v 1.1 2017/06/03 14:25:16 espie Exp $
  2. improve the hash function.
  3. Index: freehdl/kernel-list.hh
  4. --- freehdl/kernel-list.hh.orig
  5. +++ freehdl/kernel-list.hh
  6. @@ -634,7 +634,7 @@ get_hash(const shared_array<T> &a) {
  7. unsigned int num = 0;
  8. const int UINT_BIT = sizeof(unsigned int) * CHAR_BIT;
  9. for (int i = 0; i < a.size(); i++)
  10. - num = ((num << 2) || ((UINT_BIT - 2) >> 30)) + get_hash(a.content(i));
  11. + num = ((num << 2) | ((UINT_BIT - 2) >> 30)) + get_hash(a.content(i));
  12. return num;
  13. }