]> git.sesse.net Git - stockfish/commitdiff
Introduce namespace Bitbases
authorMarco Costalba <mcostalba@gmail.com>
Sat, 18 Aug 2012 12:04:43 +0000 (13:04 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 18 Aug 2012 12:08:12 +0000 (13:08 +0100)
Let's continue this namespace galore...

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/bitbase.cpp
src/bitboard.h
src/endgame.cpp
src/main.cpp

index 9d2cde030754d48799ab40bed23fc68b7751486e..fdfb207ba3be86d786b849af9b126e15513674bb 100644 (file)
@@ -62,14 +62,14 @@ namespace {
 }
 
 
 }
 
 
-uint32_t probe_kpk_bitbase(Square wksq, Square wpsq, Square bksq, Color stm) {
+uint32_t Bitbases::probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm) {
 
   int idx = index(wksq, bksq, wpsq, stm);
   return KPKBitbase[idx / 32] & (1 << (idx & 31));
 }
 
 
 
   int idx = index(wksq, bksq, wpsq, stm);
   return KPKBitbase[idx / 32] & (1 << (idx & 31));
 }
 
 
-void kpk_bitbase_init() {
+void Bitbases::init_kpk() {
 
   Result db[IndexMax];
   KPKPosition pos;
 
   Result db[IndexMax];
   KPKPosition pos;
index 2c4a0ea299f6896e739b7a0bec3291a70bbc1995..4c7c948a8d28d0dfa9e8bc8c08f88471797b2b9d 100644 (file)
 
 namespace Bitboards {
 
 
 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);
 
 }
 
 
 }
 
index 273f040ac40d5dc51219bd8e7845f81e981f9525..ef55119b76f811f4fb75e038000af6f7491336f5 100644 (file)
 #include <algorithm>
 #include <cassert>
 
 #include <algorithm>
 #include <cassert>
 
+#include "bitboard.h"
 #include "bitcount.h"
 #include "endgame.h"
 #include "movegen.h"
 
 using std::string;
 
 #include "bitcount.h"
 #include "endgame.h"
 #include "movegen.h"
 
 using std::string;
 
-extern uint32_t probe_kpk_bitbase(Square wksq, Square wpsq, Square bksq, Color stm);
-
 namespace {
 
   // Table used to drive the defending king towards the edge of the board
 namespace {
 
   // Table used to drive the defending king towards the edge of the board
@@ -223,7 +222,7 @@ Value Endgame<KPK>::operator()(const Position& pos) const {
       wpsq = mirror(wpsq);
   }
 
       wpsq = mirror(wpsq);
   }
 
-  if (!probe_kpk_bitbase(wksq, wpsq, bksq, stm))
+  if (!Bitbases::probe_kpk(wksq, wpsq, bksq, stm))
       return VALUE_DRAW;
 
   Value result =  VALUE_KNOWN_WIN
       return VALUE_DRAW;
 
   Value result =  VALUE_KNOWN_WIN
@@ -893,5 +892,5 @@ ScaleFactor Endgame<KPKP>::operator()(const Position& pos) const {
 
   // Probe the KPK bitbase with the weakest side's pawn removed. If it's a draw,
   // it's probably at least a draw even with the pawn.
 
   // Probe the KPK bitbase with the weakest side's pawn removed. If it's a draw,
   // it's probably at least a draw even with the pawn.
-  return probe_kpk_bitbase(wksq, wpsq, bksq, stm) ? SCALE_FACTOR_NONE : SCALE_FACTOR_DRAW;
+  return Bitbases::probe_kpk(wksq, wpsq, bksq, stm) ? SCALE_FACTOR_NONE : SCALE_FACTOR_DRAW;
 }
 }
index dccf7b9415ef529c72c598a937196071567c578b..d0e593daf61c6ea4f13ca3b68b0395d7053da4f8 100644 (file)
@@ -28,8 +28,6 @@
 #include "tt.h"
 #include "ucioption.h"
 
 #include "tt.h"
 #include "ucioption.h"
 
-void kpk_bitbase_init();
-
 int main(int argc, char* argv[]) {
 
   std::cout << engine_info() << std::endl;
 int main(int argc, char* argv[]) {
 
   std::cout << engine_info() << std::endl;
@@ -37,7 +35,7 @@ int main(int argc, char* argv[]) {
   UCI::init(Options);
   Bitboards::init();
   Position::init();
   UCI::init(Options);
   Bitboards::init();
   Position::init();
-  kpk_bitbase_init();
+  Bitbases::init_kpk();
   Search::init();
   Threads.init();
   Eval::init();
   Search::init();
   Threads.init();
   Eval::init();