Objective : Create a hash map that takes 2 integer keys(pointers converted to integers using unsigned int casting, and yes this works) and maps it to a single value.
Attempted Solution: So i already have a hash map that takes a single key and maps it to value successfully. I now extended it to taking two keys using a "pairing function". So i take the two keys , pair them using the Cantor pairing function and then hash this combined key .
Bottleneck: So the problem with two keys is that the cantor pairing function does a multiplication which causes integer overflow and hence "does not" give me unique outputs, as it is supposed to do mathematically.
Question:
- I see that a lot of hashing functions do multiplications. Is integer overflow a normal thing in hashing or is this bad?
- Im also thinking of doing an append of one key on the other into a new 64 bit integer. like aaaaaaaabbbbbbbb and then pass it on to the hash map. But I fear that this might cause abnormal numbers like NaN to come up due to the floating point representation, which could be bad.
- Any better ideas are welcome.
Please let me know if some parts are unclear.