vfs: check userland buffers before reading them.
[haiku.git] / headers / cpp / stl_hash_fun.h
blob44ab9bb567937a6cfe2b2193bc0b9ae25956db38
1 /*
2 * Copyright (c) 1996-1998
3 * Silicon Graphics Computer Systems, Inc.
5 * Permission to use, copy, modify, distribute and sell this software
6 * and its documentation for any purpose is hereby granted without fee,
7 * provided that the above copyright notice appear in all copies and
8 * that both that copyright notice and this permission notice appear
9 * in supporting documentation. Silicon Graphics makes no
10 * representations about the suitability of this software for any
11 * purpose. It is provided "as is" without express or implied warranty.
14 * Copyright (c) 1994
15 * Hewlett-Packard Company
17 * Permission to use, copy, modify, distribute and sell this software
18 * and its documentation for any purpose is hereby granted without fee,
19 * provided that the above copyright notice appear in all copies and
20 * that both that copyright notice and this permission notice appear
21 * in supporting documentation. Hewlett-Packard Company makes no
22 * representations about the suitability of this software for any
23 * purpose. It is provided "as is" without express or implied warranty.
27 /* NOTE: This is an internal header file, included by other STL headers.
28 * You should not attempt to use it directly.
31 #ifndef __SGI_STL_HASH_FUN_H
32 #define __SGI_STL_HASH_FUN_H
34 #include <stddef.h>
36 __STL_BEGIN_NAMESPACE
38 template <class _Key> struct hash { };
40 inline size_t __stl_hash_string(const char* __s)
42 unsigned long __h = 0;
43 for ( ; *__s; ++__s)
44 __h = 5*__h + *__s;
46 return size_t(__h);
49 __STL_TEMPLATE_NULL struct hash<char*>
51 size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
54 __STL_TEMPLATE_NULL struct hash<const char*>
56 size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
59 __STL_TEMPLATE_NULL struct hash<char> {
60 size_t operator()(char __x) const { return __x; }
62 __STL_TEMPLATE_NULL struct hash<unsigned char> {
63 size_t operator()(unsigned char __x) const { return __x; }
65 __STL_TEMPLATE_NULL struct hash<signed char> {
66 size_t operator()(unsigned char __x) const { return __x; }
68 __STL_TEMPLATE_NULL struct hash<short> {
69 size_t operator()(short __x) const { return __x; }
71 __STL_TEMPLATE_NULL struct hash<unsigned short> {
72 size_t operator()(unsigned short __x) const { return __x; }
74 __STL_TEMPLATE_NULL struct hash<int> {
75 size_t operator()(int __x) const { return __x; }
77 __STL_TEMPLATE_NULL struct hash<unsigned int> {
78 size_t operator()(unsigned int __x) const { return __x; }
80 __STL_TEMPLATE_NULL struct hash<long> {
81 size_t operator()(long __x) const { return __x; }
83 __STL_TEMPLATE_NULL struct hash<unsigned long> {
84 size_t operator()(unsigned long __x) const { return __x; }
87 __STL_END_NAMESPACE
89 #endif /* __SGI_STL_HASH_FUN_H */
91 // Local Variables:
92 // mode:C++
93 // End: