]> git.sesse.net Git - stockfish/commitdiff
Don't push on the stack 200KB in one go
authorMarco Costalba <mcostalba@gmail.com>
Sun, 30 Sep 2012 09:32:42 +0000 (11:32 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 30 Sep 2012 09:35:14 +0000 (11:35 +0200)
This could be a limit on some platforms (as it seems
to be in Native Client). Patch from a SF fork on github:

https://github.com/ccherng/Stockfish/commit/47374afd6fdfabd9de183a7a67d645daad45fb21

No functional change.

src/bitbase.cpp

index fdfb207ba3be86d786b849af9b126e15513674bb..5f0438a3846c4bbd58a0136c41ff9db24d888b82 100644 (file)
@@ -71,7 +71,7 @@ uint32_t Bitbases::probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm) {
 
 void Bitbases::init_kpk() {
 
 
 void Bitbases::init_kpk() {
 
-  Result db[IndexMax];
+  Result* db = new Result[IndexMax]; // Avoid to hit stack limit on some platforms
   KPKPosition pos;
   int idx, bit, repeat = 1;
 
   KPKPosition pos;
   int idx, bit, repeat = 1;
 
@@ -90,6 +90,8 @@ void Bitbases::init_kpk() {
       for (bit = 0; bit < 32; bit++)
           if (db[32 * idx + bit] == WIN)
               KPKBitbase[idx] |= 1 << bit;
       for (bit = 0; bit < 32; bit++)
           if (db[32 * idx + bit] == WIN)
               KPKBitbase[idx] |= 1 << bit;
+
+  delete [] db;
 }
 
 
 }