00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __SGI_STL_HASH_FUN_H
00032 #define __SGI_STL_HASH_FUN_H
00033
00034 #ifndef UNDER_CE
00035 #include <stddef.h>
00036 #else
00037 #include <wce_defs.h>
00038 #endif
00039
00040 __STL_BEGIN_NAMESPACE
00041
00042 template <class _Key> struct hash { };
00043
00044 inline size_t __stl_hash_string(const char* __s)
00045 {
00046 unsigned long __h = 0;
00047 for ( ; *__s; ++__s)
00048 __h = 5*__h + *__s;
00049
00050 return size_t(__h);
00051 }
00052
00053 __STL_TEMPLATE_NULL struct hash<char*>
00054 {
00055 size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
00056 };
00057
00058 __STL_TEMPLATE_NULL struct hash<const char*>
00059 {
00060 size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
00061 };
00062
00063 __STL_TEMPLATE_NULL struct hash<char> {
00064 size_t operator()(char __x) const { return __x; }
00065 };
00066 __STL_TEMPLATE_NULL struct hash<unsigned char> {
00067 size_t operator()(unsigned char __x) const { return __x; }
00068 };
00069 __STL_TEMPLATE_NULL struct hash<signed char> {
00070 size_t operator()(unsigned char __x) const { return __x; }
00071 };
00072 __STL_TEMPLATE_NULL struct hash<short> {
00073 size_t operator()(short __x) const { return __x; }
00074 };
00075 __STL_TEMPLATE_NULL struct hash<unsigned short> {
00076 size_t operator()(unsigned short __x) const { return __x; }
00077 };
00078 __STL_TEMPLATE_NULL struct hash<int> {
00079 size_t operator()(int __x) const { return __x; }
00080 };
00081 __STL_TEMPLATE_NULL struct hash<unsigned int> {
00082 size_t operator()(unsigned int __x) const { return __x; }
00083 };
00084 __STL_TEMPLATE_NULL struct hash<long> {
00085 size_t operator()(long __x) const { return __x; }
00086 };
00087 __STL_TEMPLATE_NULL struct hash<unsigned long> {
00088 size_t operator()(unsigned long __x) const { return __x; }
00089 };
00090
00091 __STL_END_NAMESPACE
00092
00093 #endif
00094
00095
00096
00097