TURF_ASSERT(table);
TURF_ASSERT(hash != KeyTraits::NullHash);
ureg sizeMask = table->sizeMask;
- for (ureg idx = hash;; idx++) {
+ for (ureg idx = ureg(hash);; idx++) {
idx &= sizeMask;
Cell* cell = table->getCells() + idx;
// Load the hash that was there.
- uptr probeHash = cell->hash.load(turf::Relaxed);
+ Hash probeHash = cell->hash.load(turf::Relaxed);
if (probeHash == hash) {
TURF_TRACE(Linear, 1, "[find] found existing cell", uptr(table), idx);
return cell;
TURF_ASSERT(hash != KeyTraits::NullHash);
ureg sizeMask = table->sizeMask;
- for (ureg idx = hash;; idx++) {
+ for (ureg idx = ureg(hash);; idx++) {
idx &= sizeMask;
cell = table->getCells() + idx;
// Load the existing hash.
- uptr probeHash = cell->hash.load(turf::Relaxed);
+ Hash probeHash = cell->hash.load(turf::Relaxed);
if (probeHash == hash) {
TURF_TRACE(Linear, 3, "[insert] found existing cell", uptr(table), idx);
return InsertResult_AlreadyFound; // Key found in table. Return the existing cell.
return InsertResult_Overflow;
}
// Try to reserve this cell.
- uptr prevHash = cell->hash.compareExchange(KeyTraits::NullHash, hash, turf::Relaxed);
+ Hash prevHash = cell->hash.compareExchange(KeyTraits::NullHash, hash, turf::Relaxed);
if (prevHash == KeyTraits::NullHash) {
// Success. We reserved a new cell.
TURF_TRACE(Linear, 5, "[insert] reserved cell", prevCellsRemaining, idx);