Fix compiler warnings for large-board version
authorFabian Fichter <ianfab@users.noreply.github.com>
Mon, 14 Oct 2019 13:58:46 +0000 (15:58 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Mon, 14 Oct 2019 16:15:07 +0000 (18:15 +0200)
No functional change.

src/bitbase.cpp
src/position.cpp

index 29a012d..c172aa6 100644 (file)
@@ -84,7 +84,11 @@ bool Bitbases::probe(Square wksq, Square wpsq, Square bksq, Color us) {
 
 void Bitbases::init() {
 
-#ifndef LARGEBOARDS
+#ifdef LARGEBOARDS
+    // Bitbases are not working for large-board version
+    return;
+#endif
+
   std::vector<KPKPosition> db(MAX_INDEX);
   unsigned idx, repeat = 1;
 
@@ -102,7 +106,6 @@ void Bitbases::init() {
   for (idx = 0; idx < MAX_INDEX; ++idx)
       if (db[idx] == WIN)
           KPKBitbase[idx / 32] |= 1 << (idx & 0x1F);
-#endif
 }
 
 
index 7a186e9..9f3351e 100644 (file)
@@ -269,8 +269,8 @@ Position& Position::set(const Variant* v, const string& fenStr, bool isChess960,
   size_t idx;
   std::istringstream ss(fenStr);
 
-  std::memset(this, 0, sizeof(Position));
-  std::memset(si, 0, sizeof(StateInfo));
+  std::memset(static_cast<void*>(this), 0, sizeof(Position));
+  std::memset(static_cast<void*>(si), 0, sizeof(StateInfo));
   std::fill_n(&pieceList[0][0], sizeof(pieceList) / sizeof(Square), SQ_NONE);
   var = v;
   st = si;
@@ -1057,7 +1057,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
   // Copy some fields of the old state to our new StateInfo object except the
   // ones which are going to be recalculated from scratch anyway and then switch
   // our state pointer to point to the new (ready to be updated) state.
-  std::memcpy(&newSt, st, offsetof(StateInfo, key));
+  std::memcpy(static_cast<void*>(&newSt), static_cast<void*>(st), offsetof(StateInfo, key));
   newSt.previous = st;
   st = &newSt;