Esempio n. 1
0
void init_egtb(void)
{
#ifdef USE_EGTB
  void *buffer;

  buffer = malloc(EGTBCacheSize);

  if (buffer == NULL && (EGTBCacheSize != 0)) 
  {
	printf("Could not allocate EGTB buffer.\n");
	exit(EXIT_FAILURE);
  };

  EGTBPieces = IInitializeTb (EGTBDir);

  printf("%d piece endgame tablebases found\n", EGTBPieces);
  printf("Allocated %dKb for indices and tables.\n",((cbEGTBCompBytes+1023)/1024));
  
  if(FTbSetCacheSize (buffer, EGTBCacheSize) == FALSE
      && (EGTBCacheSize != 0))
  {
  	printf("Could not enable EGTB buffer.\n");
	exit(EXIT_FAILURE);
  };
  
  return;
#else
  return;
#endif
}
Esempio n. 2
0
tablebase_t::tablebase_t(const std::string& path, const std::size_t size)
:
	_mutex(),
	_cache(new char[size]),
	_pieces(IInitializeTb(const_cast<char*>(path.data())))
{
	if (!FTbSetCacheSize(_cache.get(), size))
		std::__throw_runtime_error("FTbSetCacheSize failed.");
}
Esempio n. 3
0
// scid_TB_init:
//    Initialises the tablebases given a directory string. All the tables
//    to be used must be in the directory; subdirectories are not
//    scanned. However, the directory string may have more than one
//    dircetory in it, separated by commas (,) or semicolons (;).
//    Returns the same value as scid_TB_MaxPieces().
uint
scid_TB_Init (const char * egtb_path)
{
    EGTB_maxpieces = (uint) IInitializeTb ((char *) egtb_path);
#ifdef WINCE
    if (EGTB_cache != NULL) { my_Tcl_Free( (char *) EGTB_cache); }
    EGTB_cache = (byte *)my_Tcl_Alloc(sizeof(byte [EGTB_cachesize]));
#else
    if (EGTB_cache != NULL) { delete[] (byte *) EGTB_cache; }
    EGTB_cache = new byte [EGTB_cachesize];
#endif
    FTbSetCacheSize (EGTB_cache, EGTB_cachesize);
    return EGTB_maxpieces;
}
Esempio n. 4
0
void CTablebases::setPath(const string& path)
{
    m_loaded_men = IInitializeTb((char*)path.c_str());
    m_path = path;
}