Generic hardware access library
|
00001 #ifndef __HalHash 00002 #define __HalHash 00003 00004 #include <string> 00005 00006 namespace HAL { 00007 00026 template <class _Key> struct HalHash { }; 00027 00028 template<> 00029 struct HalHash< std::string > { 00030 size_t operator()(const std::string& __i) const { 00031 const char* __s = __i.c_str(); 00032 uint32_t __h = 0; 00033 for ( ; *__s; ++__s) 00034 __h = 5*__h + *__s; 00035 return size_t( __h ); 00036 } 00037 }; 00038 00039 } /* namespace HAL */ 00040 00041 #endif /* __HalHash */