少年修仙传客户端基础资源
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
#pragma once
 
// Off by default, can be enabled in platform specific configuration
#ifndef UNITY_ATOMIC_USE_CLANG_ATOMICS
#   define UNITY_ATOMIC_USE_CLANG_ATOMICS 0
#endif
#ifndef UNITY_ATOMIC_USE_GCC_ATOMICS
#   define UNITY_ATOMIC_USE_GCC_ATOMICS 0
#endif
 
#if UNITY_ATOMIC_USE_GCC_ATOMICS || UNITY_ATOMIC_USE_CLANG_ATOMICS
 
#include <stdint.h>
 
#   if __SIZEOF_POINTER__ == 8
typedef int64_t non_atomic_word;
typedef __int128 non_atomic_word2;
#       define UNITY_ATOMIC_INT_OVERLOAD
#   elif __SIZEOF_POINTER__ == 4
typedef int32_t non_atomic_word;
typedef int64_t non_atomic_word2;
#   else
#       error unsupported __SIZEOF_POINTER__
#   endif
 
typedef non_atomic_word atomic_word;
 
// that might look weird as we have non_atomic_word2 member that should have proper alignment
// but on arm7 (32bits) on older ios, we sometimes saw unaligned acess to atomic_word2
// it seems that adding explicit align here helps
union alignas(2 * __SIZEOF_POINTER__)atomic_word2
{
    non_atomic_word2 v;
    struct
    {
        atomic_word lo;
        atomic_word hi;
    };
};
 
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
// on arm/arm64 we have custom implementation for atomic queue (so no DCAS)
#else
    #define ATOMIC_HAS_DCAS
#endif
 
#elif defined(__x86_64__) || defined(_M_X64)
 
#   include <emmintrin.h>
 
/// atomic_word must be 8 bytes aligned if you want to use it with atomic_* ops.
#   if defined(_MSC_VER)
typedef __int64 atomic_word;
#   else
typedef long long atomic_word;
#   endif
 
/// atomic_word2 must be 16 bytes aligned if you want to use it with atomic_* ops.
union atomic_word2
{
    __m128i         v;
    struct
    {
        atomic_word lo, hi;
    };
};
    #define ATOMIC_HAS_DCAS
    #define UNITY_ATOMIC_INT_OVERLOAD
 
#elif defined(__x86__) || defined(__i386__) || defined(_M_IX86)
 
/// atomic_word must be 4 bytes aligned if you want to use it with atomic_* ops.
typedef int atomic_word;
 
/// atomic_word2 must be 8 bytes aligned if you want to use it with atomic_* ops.
union atomic_word2
{
#   if defined(_MSC_VER)
    __int64 v;
#   else
    long long v;
#   endif
#   if !defined(__SSE2__)
    double d;
#   endif
    struct
    {
        atomic_word lo, hi;
    };
};
    #define ATOMIC_HAS_DCAS
 
#elif defined(_M_ARM64) || (defined(__arm64__) || defined(__aarch64__)) && (defined(__clang__) || defined(__GNUC__))
 
typedef long long atomic_word;
struct alignas(16) atomic_word2
{
    atomic_word lo;
    atomic_word hi;
};
#   define ATOMIC_HAS_DCAS
#   define ATOMIC_HAS_LDR
#   define UNITY_ATOMIC_INT_OVERLOAD
 
#elif defined(_M_ARM) || (defined(__arm__) && (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)) && (defined(__clang__) || defined(__GNUC__)))
 
typedef int atomic_word;
union atomic_word2
{
#   if defined(_MSC_VER)
    __int64 v;
#   else
    long long v;
#   endif
    struct
    {
        atomic_word lo;
        atomic_word hi;
    };
};
#   define ATOMIC_HAS_DCAS
#   if !defined(_MSC_VER)
#       define ATOMIC_HAS_LDR
#   endif
 
 
#elif PLATFORM_WEBGL
 
    #include <stdint.h>
typedef int32_t atomic_word;
union atomic_word2
{
    int64_t  v;
    struct
    {
        atomic_word lo;
        atomic_word hi;
    };
};
 
#if SUPPORT_THREADS
#   define ATOMIC_HAS_DCAS
#   define ATOMIC_HAS_LDR
#endif
#elif defined(__ppc64__) || defined(_ARCH_PPC64)
 
typedef long atomic_word;
#   define ATOMIC_HAS_LDR
#   define UNITY_ATOMIC_INT_OVERLOAD
 
#elif defined(__ppc__)
 
typedef int atomic_word;
#   define ATOMIC_HAS_LDR
 
#else
 
#   if defined(__LP64__)
typedef long long atomic_word;
#       define UNITY_ATOMIC_INT_OVERLOAD
#   else
typedef int atomic_word;
#   endif
 
struct atomic_word2
{
    atomic_word lo;
    atomic_word hi;
};
 
#endif
 
#if defined(ATOMIC_HAS_DCAS)
 
    #define ATOMIC_HAS_QUEUE    2
 
#elif (defined(__arm64__) || defined(__aarch64__)) && (defined(__clang__) || defined(__GNUC__))
 
    #define ATOMIC_HAS_QUEUE    1
 
#elif defined(__arm__) && (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)) && (defined(__clang__) || defined(__GNUC__))
 
    #define ATOMIC_HAS_QUEUE    1
 
#else
 
    #define ATOMIC_HAS_QUEUE    0
 
#endif