Skip to content

Commit 16ff3f3

Browse files
committed
Fix
1 parent bae48fc commit 16ff3f3

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/libunicode/simd_detector.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
// auto max_simd_size() -> size_t;
1212

1313
void cpuid(int32_t out[4], int32_t eax, int32_t ecx);
14+
#if _WIN32
15+
__int64 xgetbv(unsigned int x);
16+
#elif defined(__GNUC__) || defined(__clang__)
1417
uint64_t xgetbv(unsigned int index);
15-
enum class Simd_Size
16-
{
17-
sse2,
18-
avx,
19-
};
18+
#else
19+
#endif
20+
2021
auto detect_os_avx() -> bool;
2122
auto detect_os_avx512() -> bool;
2223

@@ -65,7 +66,7 @@ auto detect_os_avx() -> bool
6566

6667
if (osUsesXSAVE_XRSTORE && cpuAVXSuport)
6768
{
68-
uint64_t const xcrFeatureMask = xgetbv(_XCR_XFEATURE_ENABLED_MASK);
69+
auto const xcrFeatureMask = xgetbv(_XCR_XFEATURE_ENABLED_MASK);
6970
avxSupported = (xcrFeatureMask & 0x6) == 0x6;
7071
}
7172

@@ -114,7 +115,7 @@ auto unicode::detail::max_simd_size() -> size_t
114115
if (nIds >= 0x00000007)
115116
{
116117
cpuid(info, 0x00000007, 0);
117-
bool const HW_AVX2 = (info[1] & ((int) 1 << 5)) != 0;
118+
bool const HW_AVX2 = (info[1] & ((int) 1 << 5));
118119
if (!HW_AVX2)
119120
return 128;
120121

0 commit comments

Comments
 (0)