summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2015-06-09 10:15:08 +0200
committerAlexander Harkness <me@bearbin.net>2015-06-09 10:15:08 +0200
commit1e77f271916ee1d1ee8c0047234662c29d2057bc (patch)
tree85cc42b6f276ff368ed70cc6e50d7000807652c7 /src/Vector3.h
parentMerge pull request #2221 from mc-server/AreaCountBlocks (diff)
parentAdded moar comments (diff)
downloadcuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.tar
cuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.tar.gz
cuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.tar.bz2
cuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.tar.lz
cuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.tar.xz
cuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.tar.zst
cuberite-1e77f271916ee1d1ee8c0047234662c29d2057bc.zip
Diffstat (limited to 'src/Vector3.h')
-rw-r--r--src/Vector3.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index 346bc1bbb..168071469 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -384,6 +384,28 @@ template <> inline Vector3<int> Vector3<int>::Floor(void) const
+template <typename What>
+class VectorHasher
+{
+public:
+ /** Provides a hash of a vector's contents */
+ size_t operator()(const Vector3<What> & a_Vector) const
+ {
+ // Guaranteed to have no hash collisions for any 128x128x128 area
+ size_t Hash = 0;
+ Hash ^= static_cast<size_t>(a_Vector.x);
+ Hash <<= 8;
+ Hash ^= static_cast<size_t>(a_Vector.y);
+ Hash <<= 8;
+ Hash ^= static_cast<size_t>(a_Vector.z);
+ return Hash;
+ }
+};
+
+
+
+
+
template <typename T>
const double Vector3<T>::EPS = 0.000001;