]> git.sesse.net Git - stockfish/blobdiff - src/bitboard.h
Contempt factor: use DrawValue also in case of stealmates
[stockfish] / src / bitboard.h
index 2c4a0ea299f6896e739b7a0bec3291a70bbc1995..6aa35874df7d3a244a8be9a919c81e09cc46105e 100644 (file)
 
 namespace Bitboards {
 
-extern void init();
-extern void print(Bitboard b);
+void init();
+void print(Bitboard b);
+
+}
+
+namespace Bitbases {
+
+void init_kpk();
+uint32_t probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm);
 
 }
 
@@ -240,6 +247,21 @@ FORCE_INLINE Square msb(Bitboard b) {
   return (Square) index;
 }
 
+#  elif defined(__arm__)
+
+FORCE_INLINE int lsb32(uint32_t v) {
+  __asm__("rbit %0, %1" : "=r"(v) : "r"(v));
+  return __builtin_clz(v);
+}
+
+FORCE_INLINE Square msb(Bitboard b) {
+  return (Square) (63 - __builtin_clzll(b));
+}
+
+FORCE_INLINE Square lsb(Bitboard b) {
+  return (Square) (uint32_t(b) ? lsb32(uint32_t(b)) : 32 + lsb32(uint32_t(b >> 32)));
+}
+
 #  else
 
 FORCE_INLINE Square lsb(Bitboard b) { // Assembly code by Heinz van Saanen