Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
01406501
Commit
01406501
authored
10 years ago
by
Nat Goodspeed
Browse files
Options
Downloads
Patches
Plain Diff
Convert llhash() to use boost::hash, per Cinder's suggestion.
parent
ce166675
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/llhash.h
+12
-31
12 additions, 31 deletions
indra/llcommon/llhash.h
with
12 additions
and
31 deletions
indra/llcommon/llhash.h
+
12
−
31
View file @
01406501
...
@@ -27,26 +27,7 @@
...
@@ -27,26 +27,7 @@
#ifndef LL_LLHASH_H
#ifndef LL_LLHASH_H
#define LL_LLHASH_H
#define LL_LLHASH_H
#include
"llpreprocessor.h"
// for GCC_VERSION
#include
<boost/functional/hash.hpp>
#if (LL_WINDOWS)
#include
<hash_map>
#include
<algorithm>
#elif LL_DARWIN || LL_LINUX
# if GCC_VERSION >= 40300 // gcc 4.3 and up
# include <backward/hashtable.h>
# elif GCC_VERSION >= 30400 // gcc 3.4 and up
# include <ext/hashtable.h>
# elif __GNUC__ >= 3
# include <ext/stl_hashtable.h>
# else
# include <hashtable.h>
# endif
#elif LL_SOLARIS
#include
<ext/hashtable.h>
#else
#error Please define your platform.
#endif
// Warning - an earlier template-based version of this routine did not do
// Warning - an earlier template-based version of this routine did not do
// the correct thing on Windows. Since this is only used to get
// the correct thing on Windows. Since this is only used to get
...
@@ -55,17 +36,17 @@
...
@@ -55,17 +36,17 @@
inline
size_t
llhash
(
const
char
*
value
)
inline
size_t
llhash
(
const
char
*
value
)
{
{
#if LL_WINDOWS
// boost::hash is defined for std::string and for char, but there's no
return
stdext
::
hash_value
(
value
);
// special overload for const char*. The lazy approach would be to
#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) )
// instantiate a std::string and take its hash, but that might be more
std
::
hash
<
const
char
*>
H
;
// overhead than our callers want. Or we could use boost::hash_range() --
return
H
(
value
);
// but that would require a preliminary pass over the value to determine
#elif LL_DARWIN || LL_LINUX || LL_SOLARIS
// the end iterator. Instead, use boost::hash_combine() to hash individual
__gnu_cxx
::
hash
<
const
char
*>
H
;
// characters.
return
H
(
value
)
;
std
::
size_t
seed
=
0
;
#else
for
(
;
*
value
;
++
value
)
#error Please define your platform.
boost
::
hash_combine
(
seed
,
*
value
);
#endif
return
seed
;
}
}
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment