Skip to content

Commit f1756a5

Browse files
authored
Add 32-bit x86 fallback for popcnt (#469)
1 parent 773e2b1 commit f1756a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/astcenc_vecmathlib_sse_4.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// ----------------------------------------------------------------------------
3-
// Copyright 2019-2023 Arm Limited
3+
// Copyright 2019-2024 Arm Limited
44
//
55
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
66
// use this file except in compliance with the License. You may obtain a copy
@@ -1307,7 +1307,11 @@ ASTCENC_SIMD_INLINE vfloat4 dot3(vfloat4 a, vfloat4 b)
13071307
*/
13081308
ASTCENC_SIMD_INLINE int popcount(uint64_t v)
13091309
{
1310+
#if !defined(__x86_64__) && !defined(_M_AMD64)
1311+
return static_cast<int>(__builtin_popcountll(v));
1312+
#else
13101313
return static_cast<int>(_mm_popcnt_u64(v));
1314+
#endif
13111315
}
13121316

13131317
#endif // ASTCENC_POPCNT >= 1

0 commit comments

Comments
 (0)