diff options
author | Graham Madarasz (Graham) <graham@lindenlab.com> | 2013-03-01 11:21:35 -0800 |
---|---|---|
committer | Graham Madarasz (Graham) <graham@lindenlab.com> | 2013-03-01 11:21:35 -0800 |
commit | dfda8826eb4654845430520dac48c011e058e1c0 (patch) | |
tree | 7ace15924b286393cc312f312bb632bc0d6eef86 /indra/llcommon | |
parent | ae1aa461ea3f96c092e2a50ae40f290b03b25356 (diff) |
Make WL updates use pre-hashed strings for uniform sets
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 1 | ||||
-rw-r--r-- | indra/llcommon/llstringtable.h | 54 | ||||
-rw-r--r-- | indra/llcommon/llthread.h | 4 |
3 files changed, 3 insertions, 56 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 5cce8ff2c4..e019c17280 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -236,6 +236,7 @@ set(llcommon_HEADER_FILES llstrider.h llstring.h llstringtable.h + llstaticstringtable.h llsys.h llthread.h llthreadsafequeue.h diff --git a/indra/llcommon/llstringtable.h b/indra/llcommon/llstringtable.h index 4f6417328c..787a046741 100644 --- a/indra/llcommon/llstringtable.h +++ b/indra/llcommon/llstringtable.h @@ -33,7 +33,6 @@ #include "llstl.h"
#include <list>
#include <set>
-#include <hash_map>
#if LL_WINDOWS
# if (_MSC_VER >= 1300 && _MSC_VER < 1400)
@@ -43,59 +42,6 @@ //# define STRING_TABLE_HASH_MAP 1
#endif
-#if STRING_TABLE_HASH_MAP
-# if LL_WINDOWS
-# include <hash_map>
-# else
-# include <ext/hash_map>
-# endif
-#endif
-
-class LLStaticHashedString
-{
-public:
-
- LLStaticHashedString(const std::string& s)
- {
- string_hash = makehash(s);
- string = s;
- }
-
- const std::string& String() const { return string; }
- size_t Hash() const { return string_hash; }
-
-protected:
-
- size_t makehash(const std::string& s)
- {
- size_t len = s.size();
- const char* c = s.c_str();
- size_t hashval = 0;
- for (size_t i=0; i<len; i++)
- {
- hashval = ((hashval<<5) + hashval) + *c++;
- }
- return hashval;
- }
-
- std::string string;
- size_t string_hash;
-};
-
-template<class T>
-struct LLStaticStringHasher
-{
- enum { bucket_size = 8 };
- size_t operator()(const T& key_value) const { return key_value.Hash(); }
- bool operator()(const T& left, const T& right) const { return left.Hash() < right.Hash(); }
-};
-
-template< typename MappedObject >
-class LL_COMMON_API LLStaticStringTable
- : public std::hash_map< LLStaticHashedString , MappedObject, LLStaticStringHasher< LLStaticHashedString > >
-{
-};
-
const U32 MAX_STRINGS_LENGTH = 256;
class LL_COMMON_API LLStringTableEntry
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index c2f4184a8a..0d22bc863d 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -262,9 +262,9 @@ public: // so that two threads who get into the if in parallel // don't both attempt to the delete. // - if (mRef == 1) - delete this; mRef--; + if (mRef == 0) + delete this; if (sMutex) sMutex->unlock(); return 0; } |