- tte = replace = first_entry(pos);
- for (int i = 0; i < 4; i++)
- {
- if (!(tte+i)->key()) // still empty
- {
- *(tte+i) = TTEntry(pos.get_key(), v, type, d, m, generation);
- writes++;
- return;
- }
- if ((tte+i)->key() == pos.get_key()) // overwrite old
- {
- if (m == MOVE_NONE)
- m = (tte+i)->move();
-
- *(tte+i) = TTEntry(pos.get_key(), v, type, d, m, generation);
- return;
- }
- if ( i == 0 // already is (replace == tte+i), common case
- || replace->generation() < (tte+i)->generation())
- continue;
-
- if ( replace->generation() > (tte+i)->generation()
- || (tte+i)->depth() < replace->depth())
- replace = tte+i;
- }
- *replace = TTEntry(pos.get_key(), v, type, d, m, generation);
- writes++;
-}
+ TTEntry* const tte = first_entry(key);
+ const uint16_t key16 = key >> 48; // Use the high 16 bits as key inside the cluster