少年修仙传客户端基础资源
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#pragma once
#include "InterpreterDefs.h"
 
namespace hybridclr
{
namespace interpreter
{
 
    inline void Copy1(void* dst, void* src)
    {
        *(uint8_t*)dst = *(uint8_t*)src;
    }
 
    inline void Copy2(void* dst, void* src)
    {
        *(uint16_t*)dst = *(uint16_t*)src;
    }
 
    inline void Copy4(void* dst, void* src)
    {
        *(uint32_t*)dst = *(uint32_t*)src;
    }
 
    inline void Copy8(void* dst, void* src)
    {
        *(uint64_t*)dst = *(uint64_t*)src;
    }
 
    inline void Copy12(void* dst, void* src)
    {
        if (dst <= src)
        {
            *(uint64_t*)dst = *(uint64_t*)src;
            *(uint32_t*)((byte*)dst + 8) = *(uint32_t*)((byte*)src + 8);
        }
        else
        {
            *(uint32_t*)((byte*)dst + 8) = *(uint32_t*)((byte*)src + 8);
            *(uint64_t*)dst = *(uint64_t*)src;
        }
    }
 
    inline void Copy16(void* dst, void* src)
    {
        if (dst <= src)
        {
            *(uint64_t*)dst = *(uint64_t*)src;
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
        }
        else
        {
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)dst = *(uint64_t*)src;
        }
    }
 
    inline void Copy20(void* dst, void* src)
    {
        if (dst <= src)
        {
            *(uint64_t*)dst = *(uint64_t*)src;
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint32_t*)((byte*)dst + 16) = *(uint32_t*)((byte*)src + 16);
        }
        else
        {
            *(uint32_t*)((byte*)dst + 16) = *(uint32_t*)((byte*)src + 16);
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)dst = *(uint64_t*)src;
        }
    }
 
    inline void Copy24(void* dst, void* src)
    {
        if (dst <= src)
        {
            *(uint64_t*)dst = *(uint64_t*)src;
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)((byte*)dst + 16) = *(uint64_t*)((byte*)src + 16);
        }
        else
        {
            *(uint64_t*)((byte*)dst + 16) = *(uint64_t*)((byte*)src + 16);
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)dst = *(uint64_t*)src;
        }
    }
 
    inline void Copy28(void* dst, void* src)
    {
        if (dst <= src)
        {
            *(uint64_t*)dst = *(uint64_t*)src;
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)((byte*)dst + 16) = *(uint64_t*)((byte*)src + 16);
            *(uint32_t*)((byte*)dst + 24) = *(uint32_t*)((byte*)src + 24);
        }
        else
        {
            *(uint32_t*)((byte*)dst + 24) = *(uint32_t*)((byte*)src + 24);
            *(uint64_t*)((byte*)dst + 16) = *(uint64_t*)((byte*)src + 16);
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)dst = *(uint64_t*)src;
        }
    }
 
    inline void Copy32(void* dst, void* src)
    {
        if (dst <= src)
        {
            *(uint64_t*)dst = *(uint64_t*)src;
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)((byte*)dst + 16) = *(uint64_t*)((byte*)src + 16);
            *(uint64_t*)((byte*)dst + 24) = *(uint64_t*)((byte*)src + 24);
        }
        else
        {
            *(uint64_t*)((byte*)dst + 24) = *(uint64_t*)((byte*)src + 24);
            *(uint64_t*)((byte*)dst + 16) = *(uint64_t*)((byte*)src + 16);
            *(uint64_t*)((byte*)dst + 8) = *(uint64_t*)((byte*)src + 8);
            *(uint64_t*)dst = *(uint64_t*)src;
        }
    }
 
    inline void CopyStackObject(StackObject* dst, void* vsrc, uint32_t count)
    {
        StackObject* src = (StackObject*)vsrc;
        IL2CPP_ASSERT(dst + count <= src || src + count <= dst);
        switch (count)
        {
        case 8: dst[7] = src[7];
        case 7: dst[6] = src[6];
        case 6: dst[5] = src[5];
        case 5: dst[4] = src[4];
        case 4: dst[3] = src[3];
        case 3: dst[2] = src[2];
        case 2: dst[1] = src[1];
        case 1: *dst = *src; break;
        case 0: break;
        default: std::memcpy(dst, src, count * sizeof(StackObject));
        }
    }
 
    inline void CopyBySize(void* dst, void* src, uint32_t size)
    {
        switch (size)
        {
        case 1: Copy1(dst, src); break;
        default: std::memmove(dst, src, size); break;
        }
    }
 
    inline void InitDefault1(void* dst)
    {
        *(uint8_t*)dst = 0;
    }
 
    inline void InitDefault2(void* dst)
    {
        *(uint16_t*)dst = 0;
    }
 
    inline void InitDefault4(void* dst)
    {
        *(uint32_t*)dst = 0;
    }
 
    inline void InitDefault8(void* dst)
    {
        *(uint64_t*)dst = 0;
    }
 
    inline void InitDefault12(void* dst)
    {
        int32_t* p = (int32_t*)dst;
        p[0] = 0;
        p[1] = 0;
        p[2] = 0;
    }
 
    inline void InitDefault16(void* dst)
    {
        *(uint64_t*)dst = 0;
        *(uint64_t*)((byte*)dst + 8) = 0;
    }
 
    inline void InitDefault20(void* dst)
    {
        int32_t* p = (int32_t*)dst;
        p[0] = 0;
        p[1] = 0;
        p[2] = 0;
        p[3] = 0;
        p[4] = 0;
    }
 
    inline void InitDefault24(void* dst)
    {
        *(uint64_t*)dst = 0;
        *(uint64_t*)((byte*)dst + 8) = 0;
        *(uint64_t*)((byte*)dst + 16) = 0;
    }
 
    inline void InitDefault28(void* dst)
    {
        int32_t* p = (int32_t*)dst;
        p[0] = 0;
        p[1] = 0;
        p[2] = 0;
        p[3] = 0;
        p[4] = 0;
        p[5] = 0;
        p[6] = 0;
    }
 
    inline void InitDefault32(void* dst)
    {
        *(uint64_t*)dst = 0;
        *(uint64_t*)((byte*)dst + 8) = 0;
        *(uint64_t*)((byte*)dst + 16) = 0;
        *(uint64_t*)((byte*)dst + 24) = 0;
    }
 
    inline void InitDefaultN(void* dst, size_t size)
    {
        std::memset(dst, 0, size);
    }
}
}