From 460e64667aa9ec5683d4b5c60db3001996d7485e Mon Sep 17 00:00:00 2001 From: root Date: Sat, 10 Jan 2015 12:05:26 +0000 Subject: [PATCH] Reduce types.h --- src/bitboard.cpp | 6 ----- src/bitboard.h | 6 ----- src/types.h | 67 +----------------------------------------------- 3 files changed, 1 insertion(+), 78 deletions(-) diff --git a/src/bitboard.cpp b/src/bitboard.cpp index 34e04001..f48d692a 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -271,9 +271,6 @@ namespace { occupancy[size] = b; reference[size] = sliding_attack(deltas, s, b); - if (HasPext) - attacks[s][_pext_u64(b, masks[s])] = reference[size]; - size++; b = (b - masks[s]) & masks[s]; } while (b); @@ -283,9 +280,6 @@ namespace { if (s < SQ_H8) attacks[s + 1] = attacks[s] + size; - if (HasPext) - continue; - // Find a magic for square 's' picking up an (almost) random number // until we find the one that passes the verification test. do { diff --git a/src/bitboard.h b/src/bitboard.h index b38fa55b..d1a74844 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -237,12 +237,6 @@ FORCE_INLINE unsigned magic_index(Square s, Bitboard occupied) { Bitboard* const Magics = Pt == ROOK ? RookMagics : BishopMagics; unsigned* const Shifts = Pt == ROOK ? RookShifts : BishopShifts; - if (HasPext) - return unsigned(_pext_u64(occupied, Masks[s])); - - if (Is64Bit) - return unsigned(((occupied & Masks[s]) * Magics[s]) >> Shifts[s]); - unsigned lo = unsigned(occupied) & unsigned(Masks[s]); unsigned hi = unsigned(occupied >> 32) & unsigned(Masks[s] >> 32); return (lo * unsigned(Magics[s]) ^ hi * unsigned(Magics[s] >> 32)) >> Shifts[s]; diff --git a/src/types.h b/src/types.h index be53a605..45206be5 100644 --- a/src/types.h +++ b/src/types.h @@ -1,69 +1,16 @@ -/* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad - - Stockfish is free software: you can redistribute it and/or modify - 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. - - Stockfish is distributed in the hope that it will be useful, - 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. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - #ifndef TYPES_H_INCLUDED #define TYPES_H_INCLUDED -/// For Linux and OSX configuration is done automatically using Makefile. To get -/// started type 'make help'. -/// -/// For Windows, part of the configuration is detected automatically, but some -/// switches need to be set manually: -/// -/// -DNDEBUG | Disable debugging mode. Always use this. -/// -/// -DNO_PREFETCH | Disable use of prefetch asm-instruction. A must if you want -/// | the executable to run on some very old machines. -/// -/// -DUSE_POPCNT | Add runtime support for use of popcnt asm-instruction. Works -/// | only in 64-bit mode. For compiling requires hardware with -/// | popcnt support. - #include #include #include #include #include +const bool HasPopCnt = true; #define unlikely(x) (x) // For code annotation purposes -#if defined(_WIN64) && !defined(IS_64BIT) -# include // MSVC popcnt and bsfq instrinsics -# define IS_64BIT -# define USE_BSFQ -#endif - -#if defined(USE_POPCNT) && defined(_MSC_VER) && defined(__INTEL_COMPILER) -# include // Intel header for _mm_popcnt_u64() intrinsic -#endif - -#if defined(USE_PEXT) -# include // Header for _pext_u64() intrinsic -#else -# define _pext_u64(b, m) (0) -#endif - -# if !defined(NO_PREFETCH) && (defined(__INTEL_COMPILER) || defined(_MSC_VER)) -# include // Intel and Microsoft header for _mm_prefetch() -# endif - #define CACHE_LINE_SIZE 64 #ifdef _MSC_VER @@ -74,18 +21,6 @@ # define FORCE_INLINE inline #endif -#ifdef USE_POPCNT -const bool HasPopCnt = true; -#else -const bool HasPopCnt = false; -#endif - -#ifdef USE_PEXT -const bool HasPext = true; -#else -const bool HasPext = false; -#endif - #ifdef IS_64BIT const bool Is64Bit = true; #else