diff options
| author | Brad Linden <brad@lindenlab.com> | 2023-08-23 12:26:14 -0700 |
|---|---|---|
| committer | Brad Linden <brad@lindenlab.com> | 2023-08-23 12:26:14 -0700 |
| commit | c6d5f11f63dfa0ac65a2afebf88b3078f571e044 (patch) | |
| tree | 63fd8081ce450fd426ea717adc04d09b0da4b713 /indra/llcommon/lluuid.h | |
| parent | ef33902f220df35727ba54ee8bc3ed02bc53d6be (diff) | |
| parent | d454512050e636a19e4b7545515dea4f4b1bbf0d (diff) | |
Merge remote-tracking branch 'origin/main' into DRTVWR-559
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 |
