#include "keystring.h" static UINT_32 HashString(const CHAR *pcKey); CKeyString::CKeyString() { m_pcValue = NULL; } CKeyString::~CKeyString() { } UINT_32 CKeyString::Hash() const { return HashString(m_pcValue); } VOID CKeyString::Display() const { if ( m_pcValue != NULL ) { printf(m_pcValue); } } /* static UINT_32 HashString(const CHAR *pcKey) { UINT_32 h; h = 0; while ( *pcKey != '\0' ) { h = (h << 4) + (UINT_32)(*((UINT_8*)pcKey)); h = (h ^ ((h & 0xf0000000) >> 24)) & 0x0fffffff; pcKey++; } return h; } static UINT_32 HashString(const CHAR *pcKey) { UINT_32 h; h = 0; while ( *pcKey != '\0' ) { h = (h << 7) + (UINT_32)(*((UINT_8*)pcKey)); h = h % m_uiBuckets; pcKey++; } return h; } */ static UINT_32 HashString(const CHAR *pcKey) { UINT_32 v, t; for ( v = 0; *pcKey != '\0'; pcKey++ ) { v = (v << 1) ^ (*pcKey); } t = v >> 10; t ^= (t >> 10); return v ^ t; }