Il2CppGenericContextHash.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #include "il2cpp-config.h"
  2. #include "il2cpp-class-internals.h"
  3. #include "Il2CppGenericContextHash.h"
  4. #include "Il2CppGenericInstHash.h"
  5. #include "Il2CppTypeHash.h"
  6. #include "utils/HashUtils.h"
  7. using il2cpp::utils::HashUtils;
  8. namespace il2cpp
  9. {
  10. namespace metadata
  11. {
  12. size_t Il2CppGenericContextHash::operator()(const Il2CppGenericContext* context) const
  13. {
  14. return Hash(context);
  15. }
  16. size_t Il2CppGenericContextHash::Hash(const Il2CppGenericContext* context)
  17. {
  18. //size_t classInstHash = HashUtils::AlignedPointerHash(context->class_inst);
  19. //size_t methodInstHash = HashUtils::AlignedPointerHash(context->method_inst);
  20. size_t classInstHash = 0;
  21. size_t methodInstHash = 0;
  22. if (context->class_inst)
  23. classInstHash = Il2CppGenericInstHash::Hash(context->class_inst);
  24. if (context->method_inst)
  25. methodInstHash = Il2CppGenericInstHash::Hash(context->method_inst);
  26. return HashUtils::Combine(classInstHash, methodInstHash);
  27. }
  28. } /* namespace vm */
  29. } /* namespace il2cpp */