williamr@2: /* williamr@2: * Copyright (c) 1996-1998 williamr@2: * Silicon Graphics Computer Systems, Inc. williamr@2: * williamr@2: * Permission to use, copy, modify, distribute and sell this software williamr@2: * and its documentation for any purpose is hereby granted without fee, williamr@2: * provided that the above copyright notice appear in all copies and williamr@2: * that both that copyright notice and this permission notice appear williamr@2: * in supporting documentation. Silicon Graphics makes no williamr@2: * representations about the suitability of this software for any williamr@2: * purpose. It is provided "as is" without express or implied warranty. williamr@2: * williamr@2: * williamr@2: * Copyright (c) 1994 williamr@2: * Hewlett-Packard Company williamr@2: * williamr@2: * Permission to use, copy, modify, distribute and sell this software williamr@2: * and its documentation for any purpose is hereby granted without fee, williamr@2: * provided that the above copyright notice appear in all copies and williamr@2: * that both that copyright notice and this permission notice appear williamr@2: * in supporting documentation. Hewlett-Packard Company makes no williamr@2: * representations about the suitability of this software for any williamr@2: * purpose. It is provided "as is" without express or implied warranty. williamr@2: * williamr@2: */ williamr@2: williamr@2: /* NOTE: This is an internal header file, included by other STL headers. williamr@2: * You should not attempt to use it directly. williamr@2: */ williamr@2: williamr@2: #ifndef _STLP_HASH_FUN_H williamr@2: #define _STLP_HASH_FUN_H williamr@2: williamr@2: # ifndef _STLP_CSTDDEF williamr@2: # include williamr@2: # endif williamr@2: williamr@2: _STLP_BEGIN_NAMESPACE williamr@2: williamr@2: template struct hash { }; williamr@2: williamr@2: inline size_t __stl_hash_string(const char* __s) williamr@2: { williamr@2: _STLP_FIX_LITERAL_BUG(__s) williamr@2: unsigned long __h = 0; williamr@2: for ( ; *__s; ++__s) williamr@2: __h = 5*__h + *__s; williamr@2: williamr@2: return size_t(__h); williamr@2: } williamr@2: williamr@2: _STLP_TEMPLATE_NULL struct hash williamr@2: { williamr@2: size_t operator()(const char* __s) const { _STLP_FIX_LITERAL_BUG(__s) return __stl_hash_string(__s); } williamr@2: }; williamr@2: williamr@2: _STLP_TEMPLATE_NULL struct hash williamr@2: { williamr@2: size_t operator()(const char* __s) const { _STLP_FIX_LITERAL_BUG(__s) return __stl_hash_string(__s); } williamr@2: }; williamr@2: williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(char __x) const { return __x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(unsigned char __x) const { return __x; } williamr@2: }; williamr@2: #ifndef _STLP_NO_SIGNED_BUILTINS williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(unsigned char __x) const { return __x; } williamr@2: }; williamr@2: #endif williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(short __x) const { return __x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(unsigned short __x) const { return __x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(int __x) const { return __x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(unsigned int __x) const { return __x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(long __x) const { return __x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(unsigned long __x) const { return __x; } williamr@2: }; williamr@2: williamr@2: # if defined (_STLP_LONG_LONG) williamr@2: _STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> { williamr@2: size_t operator()(long x) const { return x; } williamr@2: }; williamr@2: _STLP_TEMPLATE_NULL struct hash { williamr@2: size_t operator()(unsigned long x) const { return x; } williamr@2: }; williamr@2: # endif williamr@2: williamr@2: _STLP_END_NAMESPACE williamr@2: williamr@2: #endif /* _STLP_HASH_FUN_H */ williamr@2: williamr@2: // Local Variables: williamr@2: // mode:C++ williamr@2: // End: