I am exploring further (and I have already apologised for that) for the following reasons:
- my application is a chess engine and one key feature of a chess engine is the ability to detect trasnpositions (positions already analysed). to do that you need a way to map a position to a number (Zobrist keys).now the number of chess positions is numerical absurd so you can only mitigate the risk of so called "collisions" (same Zobrist key for different position) by using big keys (64 or even more..). They have demonstrated that you can expect a collision every about 2 billions position if you use a 64 bit while with a 32bit key, as I am using now, the number of collisions is way way higher and that reduces greatly the benefit of a hash table.
- I have already been given by
@Erel and
@agraham solutions which essentially make use of 8 byte arrays converted to signed long and XORArray to XOR. the XOR operations are done milions of times every seconds (actually at the moment I hardy do 1M nodes per second...but I will get there...
) so having native long arithmetic would save a lot of computations (I guess there is a reason why 99% of chess engines are coded in C...). also the Zobrist keys must be positive as they are used to index the hash table itself.
Bottom line..right now I am using 32 bit and that 's fast but generating several collisions so I may decide to go for the array of bytes and XOR array to get to the 64 bits but of course I would be much much happier if I had a native unsigned arithmetic (type and XOR) I could get the benefits of reduced collision without paying computational horse power...