Skip to content

Commit

Permalink
Add 32-bit x86 fallback for popcnt
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel committed May 19, 2024
1 parent 773e2b1 commit 7f4ad9c
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__)
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 7f4ad9c

Please sign in to comment.