+ if (b & 0xffffffff) {
+ _BitScanForward(&idx, int32_t(b));
+ return Square(idx);
+ } else {
+ _BitScanForward(&idx, int32_t(b >> 32));
+ return Square(idx + 32);
+ }
+}
+
+inline Square msb(Bitboard b) {
+ assert(b);
+ unsigned long idx;
+
+ if (b >> 32) {
+ _BitScanReverse(&idx, int32_t(b >> 32));
+ return Square(idx + 32);
+ } else {
+ _BitScanReverse(&idx, int32_t(b));
+ return Square(idx);
+ }
+}
+
+#endif
+
+#else // Compiler is neither GCC nor MSVC compatible
+
+#error "Compiler not supported."
+
+#endif
+
+
+/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard
+
+inline Square pop_lsb(Bitboard* b) {
+ assert(*b);