Young87

SmartCat's Blog

So happy to code my life!

游戏开发交流QQ群号60398951

当前位置:首页 >跨站数据测试

DJB hash function for strings

/* the famous DJB Hash Function for strings */
unsigned int DJBHash(char *str)
{
	unsigned int hash = 5381;
 
	while (*str){
		hash = ((hash << 5) + hash) + (*str++); /* times 33 */
	}
	hash &= ~(1 << 31); /* strip the highest bit */
	return hash;
}


for more information: String hash functions compare

除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog

上一篇: android内存问题详解--重要

下一篇: vs的【warning C4996:'fopen': This function or variable may be unsafe】解决方案

精华推荐