aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llhash.h
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llcommon/llhash.h
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llcommon/llhash.h')
-rw-r--r--linden/indra/llcommon/llhash.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/linden/indra/llcommon/llhash.h b/linden/indra/llcommon/llhash.h
index 0344d63..0ce1088 100644
--- a/linden/indra/llcommon/llhash.h
+++ b/linden/indra/llcommon/llhash.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -53,15 +54,20 @@
53#error Please define your platform. 54#error Please define your platform.
54#endif 55#endif
55 56
56template<class T> inline size_t llhash(T value) 57// Warning - an earlier template-based version of this routine did not do
57{ 58// the correct thing on Windows. Since this is only used to get
59// a string hash, it was converted to a regular routine and
60// unit tests added.
61
62inline size_t llhash( const char * value )
63{
58#if LL_WINDOWS 64#if LL_WINDOWS
59 return stdext::hash_value<T>(value); 65 return stdext::hash_value(value);
60#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) ) 66#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) )
61 std::hash<T> H; 67 std::hash<const char *> H;
62 return H(value); 68 return H(value);
63#elif LL_DARWIN || LL_LINUX || LL_SOLARIS 69#elif LL_DARWIN || LL_LINUX || LL_SOLARIS
64 __gnu_cxx::hash<T> H; 70 __gnu_cxx::hash<const char *> H;
65 return H(value); 71 return H(value);
66#else 72#else
67#error Please define your platform. 73#error Please define your platform.