Index: src/compatibility-c++0x.cc =================================================================== --- src/compatibility-c++0x.cc (revision 157063) +++ src/compatibility-c++0x.cc (working copy) @@ -57,6 +57,6 @@ hash::operator()(error_code __e) const { const size_t __tmp = std::_Fnv_hash::hash(__e._M_value); - return std::__hash_combine(__tmp, __e._M_cat); + return std::_Fnv_hash::__hash_combine(__e._M_cat, __tmp); } } Index: include/bits/functional_hash.h =================================================================== --- include/bits/functional_hash.h (revision 157063) +++ include/bits/functional_hash.h (working copy) @@ -123,12 +123,11 @@ struct _Fnv_hash_base { static size_t - hash(const char* __first, size_t __length) + hash(const char* __first, size_t __length, size_t __hash = 0) { - size_t __result = 0; - for (; __length > 0; --__length) - __result = (__result * 131) + *__first++; - return __result; + for (; __length; --__length) + __hash = (__hash * 131) + *__first++; + return __hash; } }; @@ -136,15 +135,15 @@ struct _Fnv_hash_base<4> { static size_t - hash(const char* __first, size_t __length) + hash(const char* __first, size_t __length, + size_t __hash = static_cast(2166136261UL)) { - size_t __result = static_cast(2166136261UL); - for (; __length > 0; --__length) + for (; __length; --__length) { - __result ^= static_cast(*__first++); - __result *= static_cast(16777619UL); + __hash ^= static_cast(*__first++); + __hash *= static_cast(16777619UL); } - return __result; + return __hash; } }; @@ -152,16 +151,15 @@ struct _Fnv_hash_base<8> { static size_t - hash(const char* __first, size_t __length) + hash(const char* __first, size_t __length, + size_t __hash = static_cast(14695981039346656037ULL)) { - size_t __result = - static_cast(14695981039346656037ULL); - for (; __length > 0; --__length) + for (; __length; --__length) { - __result ^= static_cast(*__first++); - __result *= static_cast(1099511628211ULL); + __hash ^= static_cast(*__first++); + __hash *= static_cast(1099511628211ULL); } - return __result; + return __hash; } }; @@ -175,17 +173,14 @@ hash(const _Tp& __val) { return hash(reinterpret_cast(&__val), sizeof(__val)); } + + template + static size_t + __hash_combine(const _Tp& __val, size_t __hash) + { return hash(reinterpret_cast(&__val), + sizeof(__val), __hash); } }; - // Inspired by the Boost facility hash_combine. - template - inline size_t - __hash_combine(size_t __hash, const _Tp& __val) - { - const size_t __tmp = std::_Fnv_hash::hash(__val); - return __hash ^ (__tmp + 0x9e3779b9 + (__hash << 6) + (__hash >> 2)); - } - /// Specialization for float. template<> inline size_t Index: include/std/system_error =================================================================== --- include/std/system_error (revision 157063) +++ include/std/system_error (working copy) @@ -356,7 +356,7 @@ operator()(const error_code& __e) const { const size_t __tmp = std::_Fnv_hash::hash(__e._M_value); - return std::__hash_combine(__tmp, __e._M_cat); + return std::_Fnv_hash::__hash_combine(__e._M_cat, __tmp); } };