1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_hash_fun.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,107 @@
1.4 +/*
1.5 + * Copyright (c) 1996-1998
1.6 + * Silicon Graphics Computer Systems, Inc.
1.7 + *
1.8 + * Permission to use, copy, modify, distribute and sell this software
1.9 + * and its documentation for any purpose is hereby granted without fee,
1.10 + * provided that the above copyright notice appear in all copies and
1.11 + * that both that copyright notice and this permission notice appear
1.12 + * in supporting documentation. Silicon Graphics makes no
1.13 + * representations about the suitability of this software for any
1.14 + * purpose. It is provided "as is" without express or implied warranty.
1.15 + *
1.16 + *
1.17 + * Copyright (c) 1994
1.18 + * Hewlett-Packard Company
1.19 + *
1.20 + * Permission to use, copy, modify, distribute and sell this software
1.21 + * and its documentation for any purpose is hereby granted without fee,
1.22 + * provided that the above copyright notice appear in all copies and
1.23 + * that both that copyright notice and this permission notice appear
1.24 + * in supporting documentation. Hewlett-Packard Company makes no
1.25 + * representations about the suitability of this software for any
1.26 + * purpose. It is provided "as is" without express or implied warranty.
1.27 + *
1.28 + */
1.29 +
1.30 +/* NOTE: This is an internal header file, included by other STL headers.
1.31 + * You should not attempt to use it directly.
1.32 + */
1.33 +
1.34 +#ifndef _STLP_HASH_FUN_H
1.35 +#define _STLP_HASH_FUN_H
1.36 +
1.37 +# ifndef _STLP_CSTDDEF
1.38 +# include <cstddef>
1.39 +# endif
1.40 +
1.41 +_STLP_BEGIN_NAMESPACE
1.42 +
1.43 +template <class _Key> struct hash { };
1.44 +
1.45 +inline size_t __stl_hash_string(const char* __s)
1.46 +{
1.47 + _STLP_FIX_LITERAL_BUG(__s)
1.48 + unsigned long __h = 0;
1.49 + for ( ; *__s; ++__s)
1.50 + __h = 5*__h + *__s;
1.51 +
1.52 + return size_t(__h);
1.53 +}
1.54 +
1.55 +_STLP_TEMPLATE_NULL struct hash<char*>
1.56 +{
1.57 + size_t operator()(const char* __s) const { _STLP_FIX_LITERAL_BUG(__s) return __stl_hash_string(__s); }
1.58 +};
1.59 +
1.60 +_STLP_TEMPLATE_NULL struct hash<const char*>
1.61 +{
1.62 + size_t operator()(const char* __s) const { _STLP_FIX_LITERAL_BUG(__s) return __stl_hash_string(__s); }
1.63 +};
1.64 +
1.65 +_STLP_TEMPLATE_NULL struct hash<char> {
1.66 + size_t operator()(char __x) const { return __x; }
1.67 +};
1.68 +_STLP_TEMPLATE_NULL struct hash<unsigned char> {
1.69 + size_t operator()(unsigned char __x) const { return __x; }
1.70 +};
1.71 +#ifndef _STLP_NO_SIGNED_BUILTINS
1.72 +_STLP_TEMPLATE_NULL struct hash<signed char> {
1.73 + size_t operator()(unsigned char __x) const { return __x; }
1.74 +};
1.75 +#endif
1.76 +_STLP_TEMPLATE_NULL struct hash<short> {
1.77 + size_t operator()(short __x) const { return __x; }
1.78 +};
1.79 +_STLP_TEMPLATE_NULL struct hash<unsigned short> {
1.80 + size_t operator()(unsigned short __x) const { return __x; }
1.81 +};
1.82 +_STLP_TEMPLATE_NULL struct hash<int> {
1.83 + size_t operator()(int __x) const { return __x; }
1.84 +};
1.85 +_STLP_TEMPLATE_NULL struct hash<unsigned int> {
1.86 + size_t operator()(unsigned int __x) const { return __x; }
1.87 +};
1.88 +_STLP_TEMPLATE_NULL struct hash<long> {
1.89 + size_t operator()(long __x) const { return __x; }
1.90 +};
1.91 +_STLP_TEMPLATE_NULL struct hash<unsigned long> {
1.92 + size_t operator()(unsigned long __x) const { return __x; }
1.93 +};
1.94 +
1.95 +# if defined (_STLP_LONG_LONG)
1.96 +_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> {
1.97 + size_t operator()(long x) const { return x; }
1.98 +};
1.99 +_STLP_TEMPLATE_NULL struct hash<unsigned _STLP_LONG_LONG> {
1.100 + size_t operator()(unsigned long x) const { return x; }
1.101 +};
1.102 +# endif
1.103 +
1.104 +_STLP_END_NAMESPACE
1.105 +
1.106 +#endif /* _STLP_HASH_FUN_H */
1.107 +
1.108 +// Local Variables:
1.109 +// mode:C++
1.110 +// End: