This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note, bsf/bsr are used by default. | |
// Enable /arch:AVX2 compilation for better optimizations | |
#if defined(_MSC_VER) && !defined(__clang__) | |
#include <intrin.h> | |
static __forceinline int __builtin_ctz(unsigned x) | |
{ | |
#if defined(_M_ARM) || defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64) || defined(_M_ARM64EC) | |
return (int)_CountTrailingZeros(x); |