Skip to content

Commit

Permalink
Add 32-bit x86 fallback for popcnt (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel authored May 21, 2024
1 parent 773e2b1 commit f1756a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/astcenc_vecmathlib_sse_4.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2019-2023 Arm Limited
// Copyright 2019-2024 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -1307,7 +1307,11 @@ ASTCENC_SIMD_INLINE vfloat4 dot3(vfloat4 a, vfloat4 b)
*/
ASTCENC_SIMD_INLINE int popcount(uint64_t v)
{
#if !defined(__x86_64__) && !defined(_M_AMD64)
return static_cast<int>(__builtin_popcountll(v));
#else
return static_cast<int>(_mm_popcnt_u64(v));
#endif
}

#endif // ASTCENC_POPCNT >= 1
Expand Down

0 comments on commit f1756a5

Please sign in to comment.