diff options
author | Erik Kundiman <erik@megapahit.org> | 2023-08-24 07:37:50 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2023-08-24 07:37:50 +0800 |
commit | 7f354c70ba623b591c36dadd0f6616b349be4fc7 (patch) | |
tree | 67557a9981877e6e4b1f08937dfde94e6287dc61 /indra/llprimitive | |
parent | 5b9cb5bba3c12b1b5c86ba56d43ccf06b83edc14 (diff) | |
parent | 33e0766ee08cccb480675a75d83b3a6e78849906 (diff) |
Merge tag '6.6.14-release'
source for viewer 6.6.14.581101
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llmaterialid.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index ee663f8f99..c66e3e30a3 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -66,6 +66,14 @@ public: static const LLMaterialID null; + // Returns a 64 bits digest of the material Id, by XORing its two 64 bits + // long words. HB + inline U64 getDigest64() const + { + U64* tmp = (U64*)mID; + return tmp[0] ^ tmp[1]; + } + private: void parseFromBinary(const LLSD::Binary& pMaterialID); void copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID); @@ -74,5 +82,23 @@ private: U8 mID[MATERIAL_ID_SIZE]; } ; +// std::hash implementation for LLMaterialID +namespace std +{ + template<> struct hash<LLMaterialID> + { + inline size_t operator()(const LLMaterialID& id) const noexcept + { + return (size_t)id.getDigest64(); + } + }; +} + +// For use with boost containers. +inline size_t hash_value(const LLMaterialID& id) noexcept +{ + return (size_t)id.getDigest64(); +} + #endif // LL_LLMATERIALID_H |