HashUtils.h 755 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. namespace il2cpp
  3. {
  4. namespace utils
  5. {
  6. class HashUtils
  7. {
  8. static const size_t Seed = 486187739;
  9. public:
  10. static inline size_t Combine(size_t hash1, size_t hash2)
  11. {
  12. return hash1 * Seed + hash2;
  13. }
  14. static inline size_t AlignedPointerHash(void* ptr)
  15. {
  16. return ((uintptr_t)ptr) >> 3;
  17. }
  18. };
  19. template<class T>
  20. struct PointerHash
  21. {
  22. size_t operator()(const T* value) const
  23. {
  24. return (size_t)value;
  25. }
  26. };
  27. template<class T>
  28. struct PassThroughHash
  29. {
  30. size_t operator()(T value) const
  31. {
  32. return (size_t)value;
  33. }
  34. };
  35. } /* namespace vm */
  36. } /* namespace il2cpp */