diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-08-23 22:28:01 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-08-23 22:28:01 +0300 |
commit | d08859f3f4ba8ed68d018fba033b652926d1bf6b (patch) | |
tree | fd62430b9a2987ca2eab8a8f08114f113de84120 /indra/llcommon/lluuid.h | |
parent | f40b85c4f495b9079991c41a26b76d397a6168ae (diff) | |
parent | d454512050e636a19e4b7545515dea4f4b1bbf0d (diff) |
Merge branch 'main' into DRTVWR-587-maint-V
# Conflicts:
# autobuild.xml
Diffstat (limited to 'indra/llcommon/lluuid.h')
-rw-r--r-- | indra/llcommon/lluuid.h | 50 |
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 |