28#ifndef VC_COMMON_BITSCANINTRINSICS_H_
29#define VC_COMMON_BITSCANINTRINSICS_H_
31#if defined(Vc_GCC) || defined(Vc_CLANG) || defined(Vc_APPLECLANG)
33# ifndef _bit_scan_forward
34# define _bit_scan_forward(x) __builtin_ctz(x)
36static Vc_ALWAYS_INLINE Vc_CONST
int _Vc_bit_scan_reverse_asm(
unsigned int x) {
38 __asm__(
"bsr %1,%0" :
"=r"(r) :
"X"(x));
41# define _bit_scan_reverse(x) _Vc_bit_scan_reverse_asm(x)
45static inline __forceinline
unsigned long _bit_scan_forward(
unsigned long x) {
47 _BitScanForward(&index, x);
50static inline __forceinline
unsigned long _bit_scan_reverse(
unsigned long x) {
52 _BitScanReverse(&index, x);