mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1119199 - Rewrite HashFunctions with variadic templates. r=waldo
This commit is contained in:
parent
95e222e3a6
commit
9ec69f4904
@ -187,32 +187,11 @@ AddToHash(uint32_t aHash, uintptr_t aA)
|
||||
return detail::AddUintptrToHash<sizeof(uintptr_t)>(aHash, aA);
|
||||
}
|
||||
|
||||
template<typename A, typename B>
|
||||
template<typename A, typename... Args>
|
||||
MOZ_WARN_UNUSED_RESULT uint32_t
|
||||
AddToHash(uint32_t aHash, A aA, B aB)
|
||||
AddToHash(uint32_t aHash, A aArg, Args... aArgs)
|
||||
{
|
||||
return AddToHash(AddToHash(aHash, aA), aB);
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C>
|
||||
MOZ_WARN_UNUSED_RESULT uint32_t
|
||||
AddToHash(uint32_t aHash, A aA, B aB, C aC)
|
||||
{
|
||||
return AddToHash(AddToHash(aHash, aA, aB), aC);
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C, typename D>
|
||||
MOZ_WARN_UNUSED_RESULT uint32_t
|
||||
AddToHash(uint32_t aHash, A aA, B aB, C aC, D aD)
|
||||
{
|
||||
return AddToHash(AddToHash(aHash, aA, aB, aC), aD);
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C, typename D, typename E>
|
||||
MOZ_WARN_UNUSED_RESULT uint32_t
|
||||
AddToHash(uint32_t aHash, A aA, B aB, C aC, D aD, E aE)
|
||||
{
|
||||
return AddToHash(AddToHash(aHash, aA, aB, aC, aD), aE);
|
||||
return AddToHash(AddToHash(aHash, aArg), aArgs...);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,39 +201,11 @@ AddToHash(uint32_t aHash, A aA, B aB, C aC, D aD, E aE)
|
||||
* much better than calling AddToHash(x, y), because AddToHash(x, y) assumes
|
||||
* that x has already been hashed.
|
||||
*/
|
||||
template<typename A>
|
||||
template<typename... Args>
|
||||
MOZ_WARN_UNUSED_RESULT inline uint32_t
|
||||
HashGeneric(A aA)
|
||||
HashGeneric(Args... aArgs)
|
||||
{
|
||||
return AddToHash(0, aA);
|
||||
}
|
||||
|
||||
template<typename A, typename B>
|
||||
MOZ_WARN_UNUSED_RESULT inline uint32_t
|
||||
HashGeneric(A aA, B aB)
|
||||
{
|
||||
return AddToHash(0, aA, aB);
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C>
|
||||
MOZ_WARN_UNUSED_RESULT inline uint32_t
|
||||
HashGeneric(A aA, B aB, C aC)
|
||||
{
|
||||
return AddToHash(0, aA, aB, aC);
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C, typename D>
|
||||
MOZ_WARN_UNUSED_RESULT inline uint32_t
|
||||
HashGeneric(A aA, B aB, C aC, D aD)
|
||||
{
|
||||
return AddToHash(0, aA, aB, aC, aD);
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C, typename D, typename E>
|
||||
MOZ_WARN_UNUSED_RESULT inline uint32_t
|
||||
HashGeneric(A aA, B aB, C aC, D aD, E aE)
|
||||
{
|
||||
return AddToHash(0, aA, aB, aC, aD, aE);
|
||||
return AddToHash(0, aArgs...);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
Loading…
Reference in New Issue
Block a user