2011-10-26 23:45:01 +11:00
|
|
|
/*
|
2018-08-04 15:14:06 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2011-10-26 23:45:01 +11:00
|
|
|
*
|
2019-05-12 07:52:39 +10:00
|
|
|
* Copyright 2010-2019, Danny Robson <danny@nerdcruft.net>
|
2011-10-26 23:45:01 +11:00
|
|
|
*/
|
|
|
|
|
2019-05-12 07:52:39 +10:00
|
|
|
#pragma once
|
2011-10-26 23:45:01 +11:00
|
|
|
|
2017-06-29 16:32:58 +10:00
|
|
|
#include "hash/murmur/murmur2.hpp"
|
2015-06-02 21:24:29 +10:00
|
|
|
|
2011-10-26 23:45:01 +11:00
|
|
|
#include <cstdint>
|
2011-10-29 15:05:49 +11:00
|
|
|
#include <cstdlib>
|
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
namespace cruft::hash {
|
2018-01-13 13:48:58 +11:00
|
|
|
constexpr std::uint32_t
|
|
|
|
mix (std::uint32_t a, std::uint32_t b)
|
|
|
|
{
|
|
|
|
return murmur2<std::uint32_t>::mix (a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constexpr std::uint64_t
|
|
|
|
mix (std::uint64_t a, std::uint64_t b)
|
|
|
|
{
|
|
|
|
return murmur2<std::uint64_t>::mix (a, b);
|
|
|
|
}
|
2011-10-26 23:45:01 +11:00
|
|
|
|
2019-05-12 07:52:39 +10:00
|
|
|
|
|
|
|
template <typename ValueT, typename ...ArgsT>
|
|
|
|
constexpr ValueT
|
2020-10-27 16:31:43 +11:00
|
|
|
mix (ValueT head, ValueT tail, ArgsT&&...args)
|
2019-05-12 07:52:39 +10:00
|
|
|
{
|
|
|
|
return mix (
|
|
|
|
mix (
|
|
|
|
std::forward<ValueT> (head),
|
|
|
|
std::forward<ValueT> (tail)
|
|
|
|
),
|
|
|
|
std::forward<ArgsT> (args)...
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|