mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 13:56:38 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			495 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			495 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef MISC_HASH_H
 | |
| #define MISC_HASH_H
 | |
| 
 | |
| #include <cstddef>
 | |
| #include <cstdint>
 | |
| #include <functional>
 | |
| 
 | |
| namespace Misc
 | |
| {
 | |
|     /// Implemented similar to the boost::hash_combine
 | |
|     template <class Seed, class T>
 | |
|     inline void hashCombine(Seed& seed, const T& v)
 | |
|     {
 | |
|         static_assert(sizeof(Seed) >= sizeof(std::size_t), "Resulting hash will be truncated");
 | |
|         std::hash<T> hasher;
 | |
|         seed ^= static_cast<Seed>(hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2));
 | |
|     }
 | |
| }
 | |
| 
 | |
| #endif
 |