mirror of
				https://github.com/Laupetin/OpenAssetTools.git
				synced 2025-10-31 02:26:59 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			332 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			332 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "CommonT6.h"
 | |
| 
 | |
| int CommonT6::Com_HashKey(const char* str, const int maxLen)
 | |
| {
 | |
|     if (str == nullptr)
 | |
|         return 0;
 | |
| 
 | |
|     int hash = 0;
 | |
|     for (int i = 0; i < maxLen; i++)
 | |
|     {
 | |
|         if (str[i] == '\0')
 | |
|             break;
 | |
| 
 | |
|         hash += str[i] * (0x77 + i);
 | |
|     }
 | |
| 
 | |
|     return hash ^ ((hash ^ (hash >> 10)) >> 10);
 | |
| } |