Group: comp.lang.c++
From: onelesscar
Date: Wednesday, April 09, 2008 4:12 PM
Subject: Hash key for vector of 3 ints


Hi all,


I'm currently creating my hash key by stuffing the bits into an
unsigned long long.

key = static_cast(x) | (static_cast(y) << 20) |
(static_cast(z) << 40);

But this limits the range in x,y,z.

I've made a few attempts in Visual Studio including making an XOR of
the vector ints.
I don't think the XOR gives keys that are unique enough.

error C2440: 'type cast' : cannot convert from 'const vector3i' to
'size_t' c:\program files\microsoft visual studio 8\vc\include
\xhash


Anyone have an example or hints?
thanks