X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitcount.h;h=d57b3f407339d9d2c311f9cf1a1ac12f7fbb8a94;hp=871247abcf4be72b16df1def8d04f97a6e6d8f52;hb=f1591447cf791b6c0ed4710df7eb688c65c4c20e;hpb=d63ff85a43667f8e0de7b7e163cba02193a70815 diff --git a/src/bitcount.h b/src/bitcount.h index 871247ab..d57b3f40 100644 --- a/src/bitcount.h +++ b/src/bitcount.h @@ -66,7 +66,6 @@ inline bool cpu_has_popcnt() { } #define POPCNT_INTRINSIC(x) __popcnt64(x) -#define BITSCAN_INTRINSIC(idx, x) _BitScanForward64(idx, x) #elif defined(__INTEL_COMPILER) && (defined(__x86_64) || defined(_M_X64)) // Intel compiler @@ -80,14 +79,12 @@ inline bool cpu_has_popcnt() { } #define POPCNT_INTRINSIC(x) _mm_popcnt_u64(x) -#define BITSCAN_INTRINSIC(idx, x) _BitScanForward64(idx, x) #else // Safe fallback for unsupported compilers inline bool cpu_has_popcnt() { return false; } #define POPCNT_INTRINSIC(x) count_1s(x) -#define BITSCAN_INTRINSIC(idx, x) count_1s(x) // dummy #endif @@ -168,27 +165,6 @@ inline int count_1s_max_15(Bitboard b) { } -/// pop_1st_bit() finds and clears the least significant nonzero bit in a -/// nonzero bitboard. If template parameter is true an intrinsic is called, -/// otherwise we fallback on a software implementation. - -template -inline Square pop_1st_bit(Bitboard *b) { - - return pop_1st_bit(b); -} - -template<> -inline Square pop_1st_bit(Bitboard *b) { - - unsigned long idx; - Bitboard bb = *b; - BITSCAN_INTRINSIC(&idx, bb); - *b &= (bb - 1); - return Square(idx); -} - - // Global variable initialized at startup that is set to true if // CPU on which application runs supports POPCNT intrinsic. Unless // DISABLE_POPCNT_SUPPORT is defined.