smallstringhash.h

来自「hl2 source code. Do not use it illegal.」· C头文件 代码 · 共 35 行

H
35
字号
/*----------------------------------------------------------------------
Copyright (c) 1998 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.

File:	SmallStringHash.h
Owner:	rich@woodbridgeinternalmed.com
Purpose:	Hash method for CSmallString
----------------------------------------------------------------------*/
#ifndef SMALLSTRINGHASH_H
#define SMALLSTRINGHASH_H

namespace Container
{
	inline UINT HashIt( const StringClass& s)
	{
		UINT uHash = 0;
		LPCTSTR pcszText = s;
		if (!pcszText)
			return 0;
		while( *pcszText )
		{
			uHash = uHash << 1 ^ toupper( *pcszText++ );
		}
		return uHash;
	}

	inline bool ElementsTheSame( const StringClass& lhs, const StringClass& rhs )
	{
		return !lhs.Compare(rhs);
	}

}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?