Removed useless keyword
Former-commit-id: f5932abe5443e25d4f1fbf3e97f4eb50627fac55
This commit is contained in:
parent
11c2f82835
commit
752cfdd8db
|
|
@ -9,24 +9,23 @@ namespace std
|
||||||
template<>
|
template<>
|
||||||
struct hash<NzString>
|
struct hash<NzString>
|
||||||
{
|
{
|
||||||
public:
|
size_t operator()(const NzString& str) const
|
||||||
size_t operator()(const NzString& str) const
|
{
|
||||||
|
// Algorithme DJB2
|
||||||
|
// http://www.cse.yorku.ca/~oz/hash.html
|
||||||
|
|
||||||
|
size_t h = 5381;
|
||||||
|
if (!str.IsEmpty())
|
||||||
{
|
{
|
||||||
// Algorithme DJB2
|
const char* ptr = str.GetConstBuffer();
|
||||||
// http://www.cse.yorku.ca/~oz/hash.html
|
|
||||||
|
|
||||||
size_t h = 5381;
|
do
|
||||||
if (!str.IsEmpty())
|
h = ((h << 5) + h) + *ptr;
|
||||||
{
|
while (*++ptr);
|
||||||
const char* ptr = str.GetConstBuffer();
|
|
||||||
|
|
||||||
do
|
|
||||||
h = ((h << 5) + h) + *ptr;
|
|
||||||
while (*++ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue