Loading...
Searching...
No Matches
20 || defined (_M_AMD64) \
21 || defined (__x86_64__) \
22 || defined (__AMD64__) \
23 || defined (__amd64__)
26#define MY_CPU_NAME "x32"
28#define MY_CPU_NAME "x64"
33#if defined (_M_IX86) \
36#define MY_CPU_NAME "x86"
40#if defined (_M_ARM64) \
41 || defined (__AARCH64EL__) \
42 || defined (__AARCH64EB__) \
43 || defined (__aarch64__)
45#define MY_CPU_NAME "arm64"
50 || defined (_M_ARM_NT) \
51 || defined (_M_ARMT) \
52 || defined (__arm__) \
53 || defined (__thumb__) \
54 || defined (__ARMEL__) \
55 || defined (__ARMEB__) \
56 || defined (__THUMBEL__) \
57 || defined (__THUMBEB__)
59#define MY_CPU_NAME "arm"
63#if defined (_M_IA64) \
66#define MY_CPU_NAME "ia64"
70#if defined (__mips64) \
71 || defined (__mips64__) \
72 || (defined (__mips) && (__mips == 64 || __mips == 4 || __mips == 3))
73#define MY_CPU_NAME "mips64"
75#elif defined (__mips__)
76#define MY_CPU_NAME "mips"
80#if defined (__ppc64__) \
81 || defined (__powerpc64__)
83#define MY_CPU_NAME "ppc64-32"
85#define MY_CPU_NAME "ppc64"
88#elif defined (__ppc__) \
89 || defined (__powerpc__)
90#define MY_CPU_NAME "ppc"
94#if defined (__sparc64__)
95#define MY_CPU_NAME "sparc64"
97#elif defined (__sparc__)
98#define MY_CPU_NAME "sparc"
102#if defined (MY_CPU_X86) || defined (MY_CPU_AMD64)
103#define MY_CPU_X86_OR_AMD64
113#define MY_CPU_ARM64_LE
117#define MY_CPU_IA64_LE
122#if defined (MY_CPU_X86_OR_AMD64) \
123 || defined (MY_CPU_ARM_LE) \
124 || defined (MY_CPU_ARM64_LE) \
125 || defined (MY_CPU_IA64_LE) \
126 || defined (__LITTLE_ENDIAN__) \
127 || defined (__ARMEL__) \
128 || defined (__THUMBEL__) \
129 || defined (__AARCH64EL__) \
130 || defined (__MIPSEL__) \
131 || defined (__MIPSEL) \
132 || defined (_MIPSEL) \
133 || defined (__BFIN__) \
134 || (defined (__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
138#if defined (__BIG_ENDIAN__) \
139 || defined (__ARMEB__) \
140 || defined (__THUMBEB__) \
141 || defined (__AARCH64EB__) \
142 || defined (__MIPSEB__) \
143 || defined (__MIPSEB) \
144 || defined (_MIPSEB) \
145 || defined (__m68k__) \
146 || defined (__s390__) \
147 || defined (__s390x__) \
148 || defined (__zarch__) \
149 || (defined (__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
153#if defined (MY_CPU_LE) && defined (MY_CPU_BE)
154 #error Stop_Compiling_Bad_Endian
157#if defined (MY_CPU_32BIT) && defined (MY_CPU_64BIT)
158 #error Stop_Compiling_Bad_32_64_BIT
163#define MY_CPU_NAME "LE"
164 #elif defined (MY_CPU_BE)
165#define MY_CPU_NAME "BE"
175 #if defined (MY_CPU_X86_OR_AMD64) \
176 || defined (MY_CPU_ARM64) \
177 || defined (__ARM_FEATURE_UNALIGNED)
178#define MY_CPU_LE_UNALIGN
182#ifdef MY_CPU_LE_UNALIGN
184#define GetUi16(p) (*(const UInt16 *)(const void *)(p))
185#define GetUi32(p) (*(const UInt32 *)(const void *)(p))
186#define GetUi64(p) (*(const UInt64 *)(const void *)(p))
188#define SetUi16(p, v) { *(UInt16 *)(p) = (v); }
189#define SetUi32(p, v) { *(UInt32 *)(p) = (v); }
190#define SetUi64(p, v) { *(UInt64 *)(p) = (v); }
194#define GetUi16(p) ( (UInt16) (\
195 ((const Byte *)(p))[0] | \
196 ((UInt16)((const Byte *)(p))[1] << 8) ))
199 ((const Byte *)(p))[0] | \
200 ((UInt32)((const Byte *)(p))[1] << 8) | \
201 ((UInt32)((const Byte *)(p))[2] << 16) | \
202 ((UInt32)((const Byte *)(p))[3] << 24))
204#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
206#define SetUi16(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v);\
207 _ppp_[0] = (Byte)_vvv_; \
208 _ppp_[1] = (Byte)(_vvv_ >> 8); }
210#define SetUi32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v);\
211 _ppp_[0] = (Byte)_vvv_; \
212 _ppp_[1] = (Byte)(_vvv_ >> 8); \
213 _ppp_[2] = (Byte)(_vvv_ >> 16); \
214 _ppp_[3] = (Byte)(_vvv_ >> 24); }
216#define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v);\
217 SetUi32(_ppp2_ , (UInt32)_vvv2_); \
218 SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); }
223#define MY__has_builtin(x) __has_builtin(x)
225#define MY__has_builtin(x) 0
228#if defined (MY_CPU_LE_UNALIGN) && (_MSC_VER >= 1300)
234 #pragma intrinsic(_byteswap_ushort)
235 #pragma intrinsic(_byteswap_ulong)
236 #pragma intrinsic(_byteswap_uint64)
239#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))
240#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p))
242#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v)
244#elif defined (MY_CPU_LE_UNALIGN) && ( \
245 (defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
246 || (defined (__clang__) && MY__has_builtin (__builtin_bswap16)))
249#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const Byte *)(p))
250#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const Byte *)(p))
252#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v)
257 ((UInt32)((const Byte *)(p))[0] << 24) | \
258 ((UInt32)((const Byte *)(p))[1] << 16) | \
259 ((UInt32)((const Byte *)(p))[2] << 8) | \
260 ((const Byte *)(p))[3] )
262#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
264#define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v);\
265 _ppp_[0] = (Byte)(_vvv_ >> 24); \
266 _ppp_[1] = (Byte)(_vvv_ >> 16); \
267 _ppp_[2] = (Byte)(_vvv_ >> 8); \
268 _ppp_[3] = (Byte)_vvv_; }
274#define GetBe16(p) ( (UInt16) (\
275 ((UInt16)((const Byte *)(p))[0] << 8) | \
276 ((const Byte *)(p))[1] ))
280#ifdef MY_CPU_X86_OR_AMD64
307x86cpuid_CheckAndRead (
316#define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF))
317#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF))
318#define x86cpuid_GetStepping(ver) (ver & 0xF)
325CPU_Is_Aes_Supported (
329CPU_IsSupported_PageGB (