Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

robin_hood.h: Change hash val shifts for info and idx generation #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/include/robin_hood.h
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ class Table
static constexpr uint32_t InitialInfoNumBits = 5;
static constexpr uint8_t InitialInfoInc = 1U << InitialInfoNumBits;
static constexpr size_t InfoMask = InitialInfoInc - 1U;
static constexpr uint8_t InitialInfoHashShift = 0;
static constexpr uint8_t InitialInfoHashShift = 64 - InitialInfoNumBits;
using DataPool = detail::NodeAllocator<value_type, 4, 16384, IsFlat>;

// type needs to be wider than uint8_t.
Expand Down Expand Up @@ -1355,8 +1355,8 @@ class Table
h ^= h >> 33U;

// the lower InitialInfoNumBits are reserved for info.
*info = mInfoInc + static_cast<InfoType>((h & InfoMask) >> mInfoHashShift);
*idx = (static_cast<size_t>(h) >> InitialInfoNumBits) & mMask;
*info = mInfoInc + static_cast<InfoType>(h >> mInfoHashShift);
*idx = static_cast<size_t>(h) & mMask;
}

// forwards the index by one, wrapping around at the end
Expand Down