OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libstdc++-v3/] [include/] [backward/] [hash_fun.h] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// 'struct hash' from SGI -*- C++ -*-
2
 
3
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010
4
// Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 3, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// Under Section 7 of GPL version 3, you are granted additional
18
// permissions described in the GCC Runtime Library Exception, version
19
// 3.1, as published by the Free Software Foundation.
20
 
21
// You should have received a copy of the GNU General Public License and
22
// a copy of the GCC Runtime Library Exception along with this program;
23
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24
// <http://www.gnu.org/licenses/>.
25
 
26
/*
27
 * Copyright (c) 1996-1998
28
 * Silicon Graphics Computer Systems, Inc.
29
 *
30
 * Permission to use, copy, modify, distribute and sell this software
31
 * and its documentation for any purpose is hereby granted without fee,
32
 * provided that the above copyright notice appear in all copies and
33
 * that both that copyright notice and this permission notice appear
34
 * in supporting documentation.  Silicon Graphics makes no
35
 * representations about the suitability of this software for any
36
 * purpose.  It is provided "as is" without express or implied warranty.
37
 *
38
 *
39
 * Copyright (c) 1994
40
 * Hewlett-Packard Company
41
 *
42
 * Permission to use, copy, modify, distribute and sell this software
43
 * and its documentation for any purpose is hereby granted without fee,
44
 * provided that the above copyright notice appear in all copies and
45
 * that both that copyright notice and this permission notice appear
46
 * in supporting documentation.  Hewlett-Packard Company makes no
47
 * representations about the suitability of this software for any
48
 * purpose.  It is provided "as is" without express or implied warranty.
49
 *
50
 */
51
 
52
/** @file backward/hash_fun.h
53
 *  This file is a GNU extension to the Standard C++ Library (possibly
54
 *  containing extensions from the HP/SGI STL subset).
55
 */
56
 
57
#ifndef _BACKWARD_HASH_FUN_H
58
#define _BACKWARD_HASH_FUN_H 1
59
 
60
#include <cstddef>
61
 
62
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
63
 
64
  using std::size_t;
65
 
66
  template<class _Key>
67
    struct hash { };
68
 
69
  inline size_t
70
  __stl_hash_string(const char* __s)
71
  {
72
    unsigned long __h = 0;
73
    for ( ; *__s; ++__s)
74
      __h = 5 * __h + *__s;
75
    return size_t(__h);
76
  }
77
 
78
  template<>
79
    struct hash<char*>
80
    {
81
      size_t
82
      operator()(const char* __s) const
83
      { return __stl_hash_string(__s); }
84
    };
85
 
86
  template<>
87
    struct hash<const char*>
88
    {
89
      size_t
90
      operator()(const char* __s) const
91
      { return __stl_hash_string(__s); }
92
    };
93
 
94
  template<>
95
    struct hash<char>
96
    {
97
      size_t
98
      operator()(char __x) const
99
      { return __x; }
100
    };
101
 
102
  template<>
103
    struct hash<unsigned char>
104
    {
105
      size_t
106
      operator()(unsigned char __x) const
107
      { return __x; }
108
    };
109
 
110
  template<>
111
    struct hash<signed char>
112
    {
113
      size_t
114
      operator()(unsigned char __x) const
115
      { return __x; }
116
    };
117
 
118
  template<>
119
    struct hash<short>
120
    {
121
      size_t
122
      operator()(short __x) const
123
      { return __x; }
124
    };
125
 
126
  template<>
127
    struct hash<unsigned short>
128
    {
129
      size_t
130
      operator()(unsigned short __x) const
131
      { return __x; }
132
    };
133
 
134
  template<>
135
    struct hash<int>
136
    {
137
      size_t
138
      operator()(int __x) const
139
      { return __x; }
140
    };
141
 
142
  template<>
143
    struct hash<unsigned int>
144
    {
145
      size_t
146
      operator()(unsigned int __x) const
147
      { return __x; }
148
    };
149
 
150
  template<>
151
    struct hash<long>
152
    {
153
      size_t
154
      operator()(long __x) const
155
      { return __x; }
156
    };
157
 
158
  template<>
159
    struct hash<unsigned long>
160
    {
161
      size_t
162
      operator()(unsigned long __x) const
163
      { return __x; }
164
    };
165
 
166
_GLIBCXX_END_NAMESPACE
167
 
168
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.