少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "il2cpp-config.h"
#include "il2cpp-class-internals.h"
#include "Il2CppTypeHash.h"
#include "utils/StringUtils.h"
#include "utils/HashUtils.h"
 
using il2cpp::utils::HashUtils;
using il2cpp::utils::StringUtils;
 
namespace il2cpp
{
namespace metadata
{
    size_t Il2CppTypeHash::operator()(const Il2CppType* t1) const
    {
        return Hash(t1);
    }
 
    size_t Il2CppTypeHash::Hash(const Il2CppType* t1)
    {
        size_t hash = t1->type;
 
        hash = HashUtils::Combine(hash, t1->byref);
 
        switch (t1->type)
        {
            case IL2CPP_TYPE_VALUETYPE:
            case IL2CPP_TYPE_CLASS:
            {
                return HashUtils::Combine(hash, (size_t)t1->data.typeHandle);
            }
            case IL2CPP_TYPE_SZARRAY:
            case IL2CPP_TYPE_PTR:
            {
                return HashUtils::Combine(hash, Hash(t1->data.type));
            }
            case IL2CPP_TYPE_GENERICINST:
            {
                const Il2CppGenericInst *inst = t1->data.generic_class->context.class_inst;
                hash = HashUtils::Combine(hash, (size_t)t1->data.generic_class->type->data.typeHandle);
                for (uint32_t i = 0; i < inst->type_argc; ++i)
                {
                    hash = HashUtils::Combine(hash, Hash(inst->type_argv[i]));
                }
                return hash;
            }
            default:
                return hash;
        }
        return hash;
    }
} /* namespace vm */
} /* namespace il2cpp */