Skip to content

Commit 774d543

Browse files
committed
Add boost hash_combine function
1 parent c747805 commit 774d543

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

LICENSES.third-party

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
The numba-dpex source tree includes vendored libraries governed by the following
2+
licenses.
3+
4+
5+
boost hash.hpp header
6+
---------------------
7+
8+
Boost Software License - Version 1.0 - August 17th, 2003
9+
10+
Permission is hereby granted, free of charge, to any person or organization
11+
obtaining a copy of the software and accompanying documentation covered by
12+
this license (the "Software") to use, reproduce, display, distribute,
13+
execute, and transmit the Software, and to prepare derivative works of the
14+
Software, and to permit third-parties to whom the Software is furnished to
15+
do so, all subject to the following:
16+
17+
The copyright notices in the Software and this entire statement, including
18+
the above license grant, this restriction and the following disclaimer,
19+
must be included in all copies of the Software, in whole or in part, and
20+
all derivative works of the Software, unless such copies or derivative
21+
works are solely in the form of machine-executable object code generated by
22+
a source language processor.
23+
24+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
27+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
28+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
29+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30+
DEALINGS IN THE SOFTWARE.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2005-2014 Daniel James.
2+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
3+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
5+
// Based on Peter Dimov's proposal
6+
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
7+
// issue 6.18.
8+
//
9+
// This also contains public domain code from MurmurHash. From the
10+
// MurmurHash header:
11+
12+
// MurmurHash3 was written by Austin Appleby, and is placed in the public
13+
// domain. The author hereby disclaims copyright to this source code.
14+
15+
// 2023 Intel Corporation
16+
// Copied hash_combine and hash_combine_impl from boost
17+
// (https://www.boost.org/doc/libs/1_76_0/boost/container_hash/hash.hpp) and
18+
// changed hash_combine to use std::hash<T> instead of boost::hash<T>.
19+
20+
#include <functional>
21+
22+
namespace boost
23+
{
24+
namespace hash_detail
25+
{
26+
template <typename SizeT>
27+
inline void hash_combine_impl(SizeT &seed, SizeT value)
28+
{
29+
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
30+
}
31+
} // namespace hash_detail
32+
33+
template <class T> inline void hash_combine(std::size_t &seed, T const &v)
34+
{
35+
std::hash<T> hasher;
36+
return boost::hash_detail::hash_combine_impl(seed, hasher(v));
37+
}
38+
} // namespace boost

0 commit comments

Comments
 (0)