compatibility-c++0x.cc (_Fnv_hash<4>, [...]): Add.
2009-11-21 Paolo Carlini <paolo.carlini@oracle.com> * src/compatibility-c++0x.cc (_Fnv_hash<4>, _Fnv_hash<8>): Add. From-SVN: r154361
This commit is contained in:
parent
c86818cfbe
commit
3d68714e22
@ -1,3 +1,7 @@
|
||||
2009-11-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* src/compatibility-c++0x.cc (_Fnv_hash<4>, _Fnv_hash<8>): Add.
|
||||
|
||||
2009-11-19 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* src/pool_allocator.cc: Adjust catch blocks.
|
||||
|
@ -57,6 +57,39 @@ namespace std
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Fnv_hash<4>
|
||||
{
|
||||
static size_t
|
||||
hash(const char* __first, size_t __length)
|
||||
{
|
||||
size_t __result = static_cast<size_t>(2166136261UL);
|
||||
for (; __length > 0; --__length)
|
||||
{
|
||||
__result ^= static_cast<size_t>(*__first++);
|
||||
__result *= static_cast<size_t>(16777619UL);
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct _Fnv_hash<8>
|
||||
{
|
||||
static size_t
|
||||
hash(const char* __first, size_t __length)
|
||||
{
|
||||
size_t __result =
|
||||
static_cast<size_t>(14695981039346656037ULL);
|
||||
for (; __length > 0; --__length)
|
||||
{
|
||||
__result ^= static_cast<size_t>(*__first++);
|
||||
__result *= static_cast<size_t>(1099511628211ULL);
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
};
|
||||
|
||||
#include "hash.cc"
|
||||
|
||||
template<>
|
||||
|
Loading…
Reference in New Issue
Block a user