I would suggest tossing rx_hashTableMask altogether, and changing the value of rx_hashTableSize to a nice prime number, like 257. Then the hash function can be as simple as: #define PEER_HASH(host, port) ((host ^ port) % rx_hashTableSize) -- kolya