summaryrefslogtreecommitdiff
path: root/indra/llcommon/lluuid.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/lluuid.h')
-rw-r--r--indra/llcommon/lluuid.h50
1 files changed, 22 insertions, 28 deletions
diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index c139c4eb4e..80597fa186 100644
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -116,6 +116,14 @@ public:
U16 getCRC16() const;
U32 getCRC32() const;
+ // Returns a 64 bits digest of the UUID, by XORing its two 64 bits long
+ // words. HB
+ inline U64 getDigest64() const
+ {
+ U64* tmp = (U64*)mData;
+ return tmp[0] ^ tmp[1];
+ }
+
static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal.
static const LLUUID null;
@@ -165,36 +173,22 @@ public:
LLAssetID makeAssetID(const LLUUID& session) const;
};
-// Generate a hash of an LLUUID object using the boost hash templates.
-template <>
-struct boost::hash<LLUUID>
-{
- typedef LLUUID argument_type;
- typedef std::size_t result_type;
- result_type operator()(argument_type const& s) const
- {
- result_type seed(0);
-
- for (S32 i = 0; i < UUID_BYTES; ++i)
- {
- boost::hash_combine(seed, s.mData[i]);
- }
-
- return seed;
- }
-};
-
-// Adapt boost hash to std hash
+// std::hash implementation for LLUUID
namespace std
{
- template<> struct hash<LLUUID>
- {
- std::size_t operator()(LLUUID const& s) const noexcept
- {
- return boost::hash<LLUUID>()(s);
- }
- };
+ template<> struct hash<LLUUID>
+ {
+ inline size_t operator()(const LLUUID& id) const noexcept
+ {
+ return (size_t)id.getDigest64();
+ }
+ };
}
-#endif
+// For use with boost containers.
+inline size_t hash_value(const LLUUID& id) noexcept
+{
+ return (size_t)id.getDigest64();
+}
+#endif // LL_LLUUID_H