2

In Stockfish 11, they use the high 16 bits as key inside the cluster:

const uint16_t key16 = key >> 48;  // Use the high 16 bits as key inside the cluster

This renders problem when key >> 48 equals 0 (for example: key=32401393425620 >> 48 = 0), then the function return found = false, even when found should be true.

return found = (bool)tte[i].key16, &tte[i];

Recently, they update: Use the low 16 bits as key inside the cluster

const uint16_t key16 = (uint16_t)key;  // Use the low 16 bits as key inside the cluster

But I think it doesn't guarantee the low 16 bits won't be 0 after converted from 64 bit key.

So this function is wrong? I guess they want to save memory so that they only 16 bits, but what's the point of saving if the function wrong?