Il2CppGenericMethodHash.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include "il2cpp-config.h"
  2. #include "il2cpp-class-internals.h"
  3. #include "Il2CppGenericMethodHash.h"
  4. #include "Il2CppGenericContextHash.h"
  5. #include "utils/HashUtils.h"
  6. using il2cpp::utils::HashUtils;
  7. namespace il2cpp
  8. {
  9. namespace metadata
  10. {
  11. size_t Il2CppGenericMethodHash::operator()(const Il2CppGenericMethod* method) const
  12. {
  13. return Hash(method);
  14. }
  15. size_t Il2CppGenericMethodHash::Hash(const Il2CppGenericMethod* method)
  16. {
  17. size_t tokenHash = method->methodDefinition->token;
  18. size_t contextHash = Il2CppGenericContextHash::Hash(&method->context);
  19. return HashUtils::Combine(tokenHash, contextHash);
  20. }
  21. size_t Il2CppGenericMethodHash::Hash(const Il2CppGenericMethodKey& method)
  22. {
  23. size_t methodHandleHash = HashUtils::AlignedPointerHash(method.methodDefinitionHandle);
  24. size_t contextHash = Il2CppGenericContextHash::Hash(&method.context);
  25. return HashUtils::Combine(methodHandleHash, contextHash);
  26. }
  27. } /* namespace metadata */
  28. } /* namespace il2cpp */