Ver Fonte

core: move hash() to .inl

Daniele Bartolini há 4 anos atrás
pai
commit
15b6ae5a7f
2 ficheiros alterados com 7 adições e 12 exclusões
  1. 0 9
      src/core/guid.h
  2. 7 3
      src/core/guid.inl

+ 0 - 9
src/core/guid.h

@@ -60,15 +60,6 @@ bool operator==(const Guid& a, const Guid& b);
 /// Returns whether Guid @a is lesser than @b.
 bool operator<(const Guid& a, const Guid& b);
 
-template <typename T>
-struct hash;
-
-template<>
-struct hash<Guid>
-{
-	u32 operator()(const Guid& id) const;
-};
-
 static const Guid GUID_ZERO = { 0u, 0u, 0u, 0u };
 
 } // namespace crown

+ 7 - 3
src/core/guid.inl

@@ -30,9 +30,13 @@ inline bool operator<(const Guid& a, const Guid& b)
 	return false;
 }
 
-inline u32 hash<Guid>::operator()(const Guid& id) const
+template<>
+struct hash<Guid>
 {
-	return id.data1;
-}
+	u32 operator()(const Guid& id) const
+	{
+		return u32(id.data1 ^ id.data2);
+	}
+};
 
 } // namespace crown