#if !defined(HISTORY_H_INCLUDED)
#define HISTORY_H_INCLUDED
-#include "types.h"
-#include <cstring>
#include <algorithm>
+#include <cstring>
+
+#include "types.h"
/// The History class stores statistics about how often different moves
/// have been successful or unsuccessful during the current search. These
#if !defined(LOCK_H_INCLUDED)
#define LOCK_H_INCLUDED
-#if !defined(_MSC_VER)
+#if !defined(_WIN32) && !defined(_WIN64)
# include <pthread.h>
#else
-#define NOMINMAX // disable macros min() and max()
+#if !defined(NOMINMAX)
+# define NOMINMAX // disable macros min() and max()
+#endif
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#if defined(_MSC_VER)
+#if defined(_WIN32) || defined(_WIN64)
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX // disable macros min() and max()
int system_time() {
-#if defined(_MSC_VER)
+#if defined(_WIN32) || defined(_WIN64)
struct _timeb t;
_ftime(&t);
return int(t.time * 1000 + t.millitm);
int cpu_count() {
-#if defined(_MSC_VER)
+#if defined(_WIN32) || defined(_WIN64)
SYSTEM_INFO s;
GetSystemInfo(&s);
return std::min(int(s.dwNumberOfProcessors), MAX_THREADS);
void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) {
-#if defined(_MSC_VER)
+#if defined(_WIN32) || defined(_WIN64)
int tm = msec;
#else
struct timeval t;
// and last thread are special. First one is the main search thread while the
// last one mimics a timer, they run in main_loop() and timer_loop().
-#if defined(_MSC_VER)
+#if defined(_WIN32) || defined(_WIN64)
DWORD WINAPI start_routine(LPVOID thread) {
#else
void* start_routine(void* thread) {
threads[i].do_sleep = (i != 0); // Avoid a race with start_thinking()
threads[i].threadID = i;
- bool ok = thread_create(threads[i].handle, start_routine, threads[i]);
-
- if (!ok)
+ if (!thread_create(threads[i].handle, start_routine, threads[i]))
{
std::cerr << "Failed to create thread number " << i << std::endl;
::exit(EXIT_FAILURE);