warn about exotic protocols as well
[LibreOffice.git] / include / o3tl / hash_combine.hxx
blobf56beda62672c7ad8e9e5d0e075c7a30691437a9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 namespace o3tl
14 template <typename T, typename N>
15 inline std::enable_if_t<(sizeof(N) == 4)> hash_combine(N& nSeed, T const* pValue, size_t nCount)
17 static_assert(sizeof(nSeed) == 4);
18 for (size_t i = 0; i < nCount; ++i)
20 nSeed ^= std::hash<T>{}(*pValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2);
21 ++pValue;
25 template <typename T, typename N>
26 inline std::enable_if_t<(sizeof(N) == 4)> hash_combine(N& nSeed, T const& nValue)
28 static_assert(sizeof(nSeed) == 4);
29 nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B9u + (nSeed << 6) + (nSeed >> 2);
32 template <typename T, typename N>
33 inline std::enable_if_t<(sizeof(N) == 8)> hash_combine(N& nSeed, T const* pValue, size_t nCount)
35 static_assert(sizeof(nSeed) == 8);
36 for (size_t i = 0; i < nCount; ++i)
38 nSeed ^= std::hash<T>{}(*pValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4);
39 ++pValue;
43 template <typename T, typename N>
44 inline std::enable_if_t<(sizeof(N) == 8)> hash_combine(N& nSeed, T const& nValue)
46 static_assert(sizeof(nSeed) == 8);
47 nSeed ^= std::hash<T>{}(nValue) + 0x9E3779B97F4A7C15llu + (nSeed << 12) + (nSeed >> 4);
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */