2008-08-31 23:59:13 -06:00
|
|
|
/*
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
|
|
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
|
2014-01-01 17:48:07 -07:00
|
|
|
Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish is free software: you can redistribute it and/or modify
|
2008-08-31 23:59:13 -06:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2008-09-06 04:30:07 -06:00
|
|
|
|
2008-10-19 10:56:28 -06:00
|
|
|
Stockfish is distributed in the hope that it will be useful,
|
2008-08-31 23:59:13 -06:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2008-09-06 04:30:07 -06:00
|
|
|
|
2008-08-31 23:59:13 -06:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2013-07-23 07:31:57 -06:00
|
|
|
#ifndef MISC_H_INCLUDED
|
2008-08-31 23:59:13 -06:00
|
|
|
#define MISC_H_INCLUDED
|
|
|
|
|
2014-09-14 02:06:36 -06:00
|
|
|
#include <ostream>
|
2008-08-31 23:59:13 -06:00
|
|
|
#include <string>
|
2012-03-31 05:15:57 -06:00
|
|
|
#include <vector>
|
2011-11-05 04:19:21 -06:00
|
|
|
|
2009-05-10 05:21:45 -06:00
|
|
|
#include "types.h"
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2014-11-01 23:10:31 -06:00
|
|
|
const std::string engine_info(bool to_uci = false);
|
|
|
|
void timed_wait(WaitCondition&, Lock&, int);
|
|
|
|
void prefetch(char* addr);
|
|
|
|
void start_logger(bool b);
|
|
|
|
|
|
|
|
void dbg_hit_on(bool b);
|
|
|
|
void dbg_hit_on_c(bool c, bool b);
|
|
|
|
void dbg_mean_of(int v);
|
|
|
|
void dbg_print();
|
2008-10-11 11:25:16 -06:00
|
|
|
|
2012-03-03 01:35:56 -07:00
|
|
|
|
2012-09-04 01:38:51 -06:00
|
|
|
namespace Time {
|
|
|
|
typedef int64_t point;
|
2013-08-03 10:30:43 -06:00
|
|
|
inline point now() { return system_time_to_msec(); }
|
2012-09-04 01:38:51 -06:00
|
|
|
}
|
2012-03-03 01:35:56 -07:00
|
|
|
|
2012-03-31 05:15:57 -06:00
|
|
|
|
|
|
|
template<class Entry, int Size>
|
|
|
|
struct HashTable {
|
2014-02-14 01:42:50 -07:00
|
|
|
HashTable() : table(Size, Entry()) {}
|
|
|
|
Entry* operator[](Key k) { return &table[(uint32_t)k & (Size - 1)]; }
|
2012-03-31 05:15:57 -06:00
|
|
|
|
|
|
|
private:
|
2014-02-14 01:42:50 -07:00
|
|
|
std::vector<Entry> table;
|
2012-03-31 05:15:57 -06:00
|
|
|
};
|
|
|
|
|
2012-08-29 03:25:11 -06:00
|
|
|
|
2014-02-09 09:31:45 -07:00
|
|
|
enum SyncCout { IO_LOCK, IO_UNLOCK };
|
2012-08-29 03:25:11 -06:00
|
|
|
std::ostream& operator<<(std::ostream&, SyncCout);
|
|
|
|
|
2014-02-09 09:31:45 -07:00
|
|
|
#define sync_cout std::cout << IO_LOCK
|
|
|
|
#define sync_endl std::endl << IO_UNLOCK
|
2012-08-29 03:25:11 -06:00
|
|
|
|
2013-07-23 07:31:57 -06:00
|
|
|
#endif // #ifndef MISC_H_INCLUDED
|