Permalink
Browse files

Don't push on the stack 200KB in one go

This could be a limit on some platforms (as it seems
to be in Native Client). Patch from a SF fork on github:

ccherng@47374af

No functional change.
  • Loading branch information...
1 parent ed0fb0b commit faaa1f11164f350427a6950b2ea75a646e3e87c8 @mcostalba committed Sep 30, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/bitbase.cpp
View
@@ -71,7 +71,7 @@ uint32_t Bitbases::probe_kpk(Square wksq, Square wpsq, Square bksq, Color stm) {
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;
@@ -90,6 +90,8 @@ void Bitbases::init_kpk() {
for (bit = 0; bit < 32; bit++)
if (db[32 * idx + bit] == WIN)
KPKBitbase[idx] |= 1 << bit;
+
+ delete [] db;
}

0 comments on commit faaa1f1

Please sign in to comment.