18d2ed566SAlexis Hunt// -*- C++ -*-
2eb8650a7SLouis Dionne//===----------------------------------------------------------------------===//
38d2ed566SAlexis Hunt//
457b08b09SChandler Carruth// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
557b08b09SChandler Carruth// See https://llvm.org/LICENSE.txt for license information.
657b08b09SChandler Carruth// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
78d2ed566SAlexis Hunt//
88d2ed566SAlexis Hunt//===----------------------------------------------------------------------===//
98d2ed566SAlexis Hunt
108d2ed566SAlexis Hunt#ifndef _LIBCPP_EXT_HASH
118d2ed566SAlexis Hunt#define _LIBCPP_EXT_HASH
128d2ed566SAlexis Hunt
138d2ed566SAlexis Hunt#  pragma GCC system_header
148d2ed566SAlexis Hunt
15bd441745SNikolas Klauser#include <__config>
168d2ed566SAlexis Hunt#include <cstring>
174d81a46fSArthur O'Dwyer#include <string>
188d2ed566SAlexis Hunt
198d2ed566SAlexis Huntnamespace __gnu_cxx {
208d2ed566SAlexis Hunt
21e2f2d1edSEric Fiseliertemplate <typename _Tp> struct _LIBCPP_TEMPLATE_VIS hash { };
228d2ed566SAlexis Hunt
23e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<const char*>
24*681cde7dSNikolas Klauser : public std::__unary_function<const char*, size_t>
258d2ed566SAlexis Hunt{
268d2ed566SAlexis Hunt    _LIBCPP_INLINE_VISIBILITY
278d2ed566SAlexis Hunt    size_t operator()(const char *__c) const _NOEXCEPT
288d2ed566SAlexis Hunt    {
29549ddae5SEric Fiselier        return std::__do_string_hash(__c, __c + strlen(__c));
308d2ed566SAlexis Hunt    }
318d2ed566SAlexis Hunt};
328d2ed566SAlexis Hunt
33e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<char *>
34*681cde7dSNikolas Klauser : public std::__unary_function<char*, size_t>
358d2ed566SAlexis Hunt{
368d2ed566SAlexis Hunt    _LIBCPP_INLINE_VISIBILITY
378d2ed566SAlexis Hunt    size_t operator()(char *__c) const _NOEXCEPT
388d2ed566SAlexis Hunt    {
39549ddae5SEric Fiselier        return std::__do_string_hash<const char *>(__c, __c + strlen(__c));
408d2ed566SAlexis Hunt    }
418d2ed566SAlexis Hunt};
428845dbd7SPeter Collingbourne
43e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<char>
44*681cde7dSNikolas Klauser : public std::__unary_function<char, size_t>
458845dbd7SPeter Collingbourne{
468845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
478845dbd7SPeter Collingbourne    size_t operator()(char __c) const _NOEXCEPT
488845dbd7SPeter Collingbourne    {
498845dbd7SPeter Collingbourne        return __c;
508845dbd7SPeter Collingbourne    }
518845dbd7SPeter Collingbourne};
528845dbd7SPeter Collingbourne
53e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<signed char>
54*681cde7dSNikolas Klauser : public std::__unary_function<signed char, size_t>
558845dbd7SPeter Collingbourne{
568845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
578845dbd7SPeter Collingbourne    size_t operator()(signed char __c) const _NOEXCEPT
588845dbd7SPeter Collingbourne    {
598845dbd7SPeter Collingbourne        return __c;
608845dbd7SPeter Collingbourne    }
618845dbd7SPeter Collingbourne};
628845dbd7SPeter Collingbourne
63e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
64*681cde7dSNikolas Klauser : public std::__unary_function<unsigned char, size_t>
658845dbd7SPeter Collingbourne{
668845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
678845dbd7SPeter Collingbourne    size_t operator()(unsigned char __c) const _NOEXCEPT
688845dbd7SPeter Collingbourne    {
698845dbd7SPeter Collingbourne        return __c;
708845dbd7SPeter Collingbourne    }
718845dbd7SPeter Collingbourne};
728845dbd7SPeter Collingbourne
73e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<short>
74*681cde7dSNikolas Klauser : public std::__unary_function<short, size_t>
758845dbd7SPeter Collingbourne{
768845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
778845dbd7SPeter Collingbourne    size_t operator()(short __c) const _NOEXCEPT
788845dbd7SPeter Collingbourne    {
798845dbd7SPeter Collingbourne        return __c;
808845dbd7SPeter Collingbourne    }
818845dbd7SPeter Collingbourne};
828845dbd7SPeter Collingbourne
83e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
84*681cde7dSNikolas Klauser : public std::__unary_function<unsigned short, size_t>
858845dbd7SPeter Collingbourne{
868845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
878845dbd7SPeter Collingbourne    size_t operator()(unsigned short __c) const _NOEXCEPT
888845dbd7SPeter Collingbourne    {
898845dbd7SPeter Collingbourne        return __c;
908845dbd7SPeter Collingbourne    }
918845dbd7SPeter Collingbourne};
928845dbd7SPeter Collingbourne
93e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<int>
94*681cde7dSNikolas Klauser    : public std::__unary_function<int, size_t>
958845dbd7SPeter Collingbourne{
968845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
978845dbd7SPeter Collingbourne    size_t operator()(int __c) const _NOEXCEPT
988845dbd7SPeter Collingbourne    {
998845dbd7SPeter Collingbourne        return __c;
1008845dbd7SPeter Collingbourne    }
1018845dbd7SPeter Collingbourne};
1028845dbd7SPeter Collingbourne
103e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
104*681cde7dSNikolas Klauser    : public std::__unary_function<unsigned int, size_t>
1058845dbd7SPeter Collingbourne{
1068845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
1078845dbd7SPeter Collingbourne    size_t operator()(unsigned int __c) const _NOEXCEPT
1088845dbd7SPeter Collingbourne    {
1098845dbd7SPeter Collingbourne        return __c;
1108845dbd7SPeter Collingbourne    }
1118845dbd7SPeter Collingbourne};
1128845dbd7SPeter Collingbourne
113e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<long>
114*681cde7dSNikolas Klauser    : public std::__unary_function<long, size_t>
1158845dbd7SPeter Collingbourne{
1168845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
1178845dbd7SPeter Collingbourne    size_t operator()(long __c) const _NOEXCEPT
1188845dbd7SPeter Collingbourne    {
1198845dbd7SPeter Collingbourne        return __c;
1208845dbd7SPeter Collingbourne    }
1218845dbd7SPeter Collingbourne};
1228845dbd7SPeter Collingbourne
123e2f2d1edSEric Fiseliertemplate <> struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
124*681cde7dSNikolas Klauser    : public std::__unary_function<unsigned long, size_t>
1258845dbd7SPeter Collingbourne{
1268845dbd7SPeter Collingbourne    _LIBCPP_INLINE_VISIBILITY
1278845dbd7SPeter Collingbourne    size_t operator()(unsigned long __c) const _NOEXCEPT
1288845dbd7SPeter Collingbourne    {
1298845dbd7SPeter Collingbourne        return __c;
1308845dbd7SPeter Collingbourne    }
1318845dbd7SPeter Collingbourne};
132d2b0df35SNikolas Klauser} // namespace __gnu_cxx
1338d2ed566SAlexis Hunt
134119703f9SHoward Hinnant#endif // _LIBCPP_EXT_HASH
135