mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Use #ifndef instead of #if !defined
And #ifdef instead of #if defined This is more standard form (see for example iostream file). No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
4064ee5406
commit
002062ae93
23 changed files with 57 additions and 57 deletions
|
@ -83,7 +83,7 @@ namespace {
|
|||
/// lsb()/msb() finds the least/most significant bit in a nonzero bitboard.
|
||||
/// pop_lsb() finds and clears the least significant bit in a nonzero bitboard.
|
||||
|
||||
#if !defined(USE_BSFQ)
|
||||
#ifndef USE_BSFQ
|
||||
|
||||
Square lsb(Bitboard b) { return BSFTable[bsf_index(b)]; }
|
||||
|
||||
|
@ -122,7 +122,7 @@ Square msb(Bitboard b) {
|
|||
return (Square)(result + MS1BTable[b32]);
|
||||
}
|
||||
|
||||
#endif // !defined(USE_BSFQ)
|
||||
#endif // ifndef USE_BSFQ
|
||||
|
||||
|
||||
/// Bitboards::print() prints a bitboard in an easily readable format to the
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(BITBOARD_H_INCLUDED)
|
||||
#ifndef BITBOARD_H_INCLUDED
|
||||
#define BITBOARD_H_INCLUDED
|
||||
|
||||
#include "types.h"
|
||||
|
@ -258,7 +258,7 @@ inline Bitboard attacks_bb(Square s, Bitboard occ) {
|
|||
/// lsb()/msb() finds the least/most significant bit in a nonzero bitboard.
|
||||
/// pop_lsb() finds and clears the least significant bit in a nonzero bitboard.
|
||||
|
||||
#if defined(USE_BSFQ)
|
||||
#ifdef BSFQ
|
||||
|
||||
# if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
|
||||
|
||||
|
@ -311,7 +311,7 @@ FORCE_INLINE Square pop_lsb(Bitboard* b) {
|
|||
return s;
|
||||
}
|
||||
|
||||
#else // if !defined(USE_BSFQ)
|
||||
#else // if defined(USE_BSFQ)
|
||||
|
||||
extern Square msb(Bitboard b);
|
||||
extern Square lsb(Bitboard b);
|
||||
|
@ -319,4 +319,4 @@ extern Square pop_lsb(Bitboard* b);
|
|||
|
||||
#endif
|
||||
|
||||
#endif // !defined(BITBOARD_H_INCLUDED)
|
||||
#endif // #ifndef BITBOARD_H_INCLUDED
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(BITCOUNT_H_INCLUDED)
|
||||
#ifndef BITCOUNT_H_INCLUDED
|
||||
#define BITCOUNT_H_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
|
@ -81,7 +81,7 @@ inline int popcount<CNT_32_MAX15>(Bitboard b) {
|
|||
template<>
|
||||
inline int popcount<CNT_HW_POPCNT>(Bitboard b) {
|
||||
|
||||
#if !defined(USE_POPCNT)
|
||||
#ifndef USE_POPCNT
|
||||
|
||||
assert(false);
|
||||
return b != 0; // Avoid 'b not used' warning
|
||||
|
@ -102,4 +102,4 @@ inline int popcount<CNT_HW_POPCNT>(Bitboard b) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // !defined(BITCOUNT_H_INCLUDED)
|
||||
#endif // #ifndef BITCOUNT_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(BOOK_H_INCLUDED)
|
||||
#ifndef BOOK_H_INCLUDED
|
||||
#define BOOK_H_INCLUDED
|
||||
|
||||
#include <fstream>
|
||||
|
@ -42,4 +42,4 @@ private:
|
|||
std::string fileName;
|
||||
};
|
||||
|
||||
#endif // !defined(BOOK_H_INCLUDED)
|
||||
#endif // #ifndef BOOK_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(ENDGAME_H_INCLUDED)
|
||||
#ifndef ENDGAME_H_INCLUDED
|
||||
#define ENDGAME_H_INCLUDED
|
||||
|
||||
#include <map>
|
||||
|
@ -119,4 +119,4 @@ public:
|
|||
{ return eg = map(eg).count(key) ? map(eg)[key] : NULL; }
|
||||
};
|
||||
|
||||
#endif // !defined(ENDGAME_H_INCLUDED)
|
||||
#endif // #ifndef ENDGAME_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(EVALUATE_H_INCLUDED)
|
||||
#ifndef EVALUATE_H_INCLUDED
|
||||
#define EVALUATE_H_INCLUDED
|
||||
|
||||
#include "types.h"
|
||||
|
@ -32,4 +32,4 @@ extern std::string trace(const Position& pos);
|
|||
|
||||
}
|
||||
|
||||
#endif // !defined(EVALUATE_H_INCLUDED)
|
||||
#endif // #ifndef EVALUATE_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(MATERIAL_H_INCLUDED)
|
||||
#ifndef MATERIAL_H_INCLUDED
|
||||
#define MATERIAL_H_INCLUDED
|
||||
|
||||
#include "endgame.h"
|
||||
|
@ -74,4 +74,4 @@ inline ScaleFactor Entry::scale_factor(const Position& pos, Color c) const {
|
|||
|
||||
}
|
||||
|
||||
#endif // !defined(MATERIAL_H_INCLUDED)
|
||||
#endif // #ifndef MATERIAL_H_INCLUDED
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "misc.h"
|
||||
#include "thread.h"
|
||||
|
||||
#if defined(__hpux)
|
||||
#ifdef __hpux
|
||||
# include <sys/pstat.h>
|
||||
#endif
|
||||
|
||||
|
@ -173,7 +173,7 @@ void start_logger(bool b) { Logger::start(b); }
|
|||
|
||||
int cpu_count() {
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
SYSTEM_INFO s;
|
||||
GetSystemInfo(&s);
|
||||
return s.dwNumberOfProcessors;
|
||||
|
@ -199,7 +199,7 @@ int cpu_count() {
|
|||
|
||||
void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) {
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
int tm = msec;
|
||||
#else
|
||||
timespec ts, *tm = &ts;
|
||||
|
@ -216,7 +216,7 @@ void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) {
|
|||
/// prefetch() preloads the given address in L1/L2 cache. This is a non
|
||||
/// blocking function and do not stalls the CPU waiting for data to be
|
||||
/// loaded from memory, that can be quite slow.
|
||||
#if defined(NO_PREFETCH)
|
||||
#ifdef NO_PREFETCH
|
||||
|
||||
void prefetch(char*) {}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(MISC_H_INCLUDED)
|
||||
#ifndef MISC_H_INCLUDED
|
||||
#define MISC_H_INCLUDED
|
||||
|
||||
#include <fstream>
|
||||
|
@ -66,4 +66,4 @@ std::ostream& operator<<(std::ostream&, SyncCout);
|
|||
#define sync_cout std::cout << io_lock
|
||||
#define sync_endl std::endl << io_unlock
|
||||
|
||||
#endif // !defined(MISC_H_INCLUDED)
|
||||
#endif // #ifndef MISC_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(MOVEGEN_H_INCLUDED)
|
||||
#ifndef MOVEGEN_H_INCLUDED
|
||||
#define MOVEGEN_H_INCLUDED
|
||||
|
||||
#include "types.h"
|
||||
|
@ -55,4 +55,4 @@ private:
|
|||
ExtMove *cur, *last;
|
||||
};
|
||||
|
||||
#endif // !defined(MOVEGEN_H_INCLUDED)
|
||||
#endif // #ifndef MOVEGEN_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined MOVEPICK_H_INCLUDED
|
||||
#ifndef MOVEPICK_H_INCLUDED
|
||||
#define MOVEPICK_H_INCLUDED
|
||||
|
||||
#include <algorithm> // For std::max
|
||||
|
@ -107,4 +107,4 @@ private:
|
|||
ExtMove moves[MAX_MOVES];
|
||||
};
|
||||
|
||||
#endif // !defined(MOVEPICK_H_INCLUDED)
|
||||
#endif // #ifndef MOVEPICK_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(NOTATION_H_INCLUDED)
|
||||
#ifndef NOTATION_H_INCLUDED
|
||||
#define NOTATION_H_INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
@ -32,4 +32,4 @@ const std::string move_to_uci(Move m, bool chess960);
|
|||
const std::string move_to_san(Position& pos, Move m);
|
||||
std::string pretty_pv(Position& pos, int depth, Value score, int64_t msecs, Move pv[]);
|
||||
|
||||
#endif // !defined(NOTATION_H_INCLUDED)
|
||||
#endif // #ifndef NOTATION_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(PAWNS_H_INCLUDED)
|
||||
#ifndef PAWNS_H_INCLUDED
|
||||
#define PAWNS_H_INCLUDED
|
||||
|
||||
#include "misc.h"
|
||||
|
@ -75,4 +75,4 @@ Entry* probe(const Position& pos, Table& entries);
|
|||
|
||||
}
|
||||
|
||||
#endif // !defined(PAWNS_H_INCLUDED)
|
||||
#endif // #ifndef PAWNS_H_INCLUDED
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(PLATFORM_H_INCLUDED)
|
||||
#ifndef PLATFORM_H_INCLUDED
|
||||
#define PLATFORM_H_INCLUDED
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
|
||||
// Disable some silly and noisy warning from MSVC compiler
|
||||
#pragma warning(disable: 4127) // Conditional expression is constant
|
||||
|
@ -43,7 +43,7 @@ typedef unsigned __int64 uint64_t;
|
|||
# include <unistd.h> // Used by sysconf(_SC_NPROCESSORS_ONLN)
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) // Linux - Unix
|
||||
#ifndef _WIN32 // Linux - Unix
|
||||
|
||||
# include <sys/time.h>
|
||||
typedef timeval sys_time_t;
|
||||
|
@ -77,7 +77,7 @@ typedef _timeb sys_time_t;
|
|||
inline void system_time(sys_time_t* t) { _ftime(t); }
|
||||
inline int64_t time_to_msec(const sys_time_t& t) { return t.time * 1000LL + t.millitm; }
|
||||
|
||||
#if !defined(NOMINMAX)
|
||||
#ifndef NOMINMAX
|
||||
# define NOMINMAX // disable macros min() and max()
|
||||
#endif
|
||||
|
||||
|
@ -110,4 +110,4 @@ inline DWORD* dwWin9xKludge() { static DWORD dw; return &dw; }
|
|||
|
||||
#endif
|
||||
|
||||
#endif // !defined(PLATFORM_H_INCLUDED)
|
||||
#endif // #ifndef PLATFORM_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(POSITION_H_INCLUDED)
|
||||
#ifndef POSITION_H_INCLUDED
|
||||
#define POSITION_H_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
|
@ -414,4 +414,4 @@ inline Thread* Position::this_thread() const {
|
|||
return thisThread;
|
||||
}
|
||||
|
||||
#endif // !defined(POSITION_H_INCLUDED)
|
||||
#endif // #ifndef POSITION_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(PSQTAB_H_INCLUDED)
|
||||
#ifndef PSQTAB_H_INCLUDED
|
||||
#define PSQTAB_H_INCLUDED
|
||||
|
||||
#include "types.h"
|
||||
|
@ -95,4 +95,4 @@ static const Score PSQT[][SQUARE_NB] = {
|
|||
|
||||
#undef S
|
||||
|
||||
#endif // !defined(PSQTAB_H_INCLUDED)
|
||||
#endif // #ifndef PSQTAB_H_INCLUDED
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
(at your option) any later version.
|
||||
*/
|
||||
|
||||
#if !defined(RKISS_H_INCLUDED)
|
||||
#ifndef RKISS_H_INCLUDED
|
||||
#define RKISS_H_INCLUDED
|
||||
|
||||
#include "types.h"
|
||||
|
@ -71,4 +71,4 @@ public:
|
|||
template<typename T> T rand() { return T(rand64()); }
|
||||
};
|
||||
|
||||
#endif // !defined(RKISS_H_INCLUDED)
|
||||
#endif // #ifndef RKISS_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(SEARCH_H_INCLUDED)
|
||||
#ifndef SEARCH_H_INCLUDED
|
||||
#define SEARCH_H_INCLUDED
|
||||
|
||||
#include <cstring>
|
||||
|
@ -109,4 +109,4 @@ extern void think();
|
|||
|
||||
} // namespace Search
|
||||
|
||||
#endif // !defined(SEARCH_H_INCLUDED)
|
||||
#endif // #ifndef SEARCH_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(THREAD_H_INCLUDED)
|
||||
#ifndef THREAD_H_INCLUDED
|
||||
#define THREAD_H_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
|
@ -165,4 +165,4 @@ struct ThreadPool : public std::vector<Thread*> {
|
|||
|
||||
extern ThreadPool Threads;
|
||||
|
||||
#endif // !defined(THREAD_H_INCLUDED)
|
||||
#endif // #ifndef THREAD_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(TIMEMAN_H_INCLUDED)
|
||||
#ifndef TIMEMAN_H_INCLUDED
|
||||
#define TIMEMAN_H_INCLUDED
|
||||
|
||||
/// The TimeManager class computes the optimal time to think depending on the
|
||||
|
@ -36,4 +36,4 @@ private:
|
|||
int unstablePVExtraTime;
|
||||
};
|
||||
|
||||
#endif // !defined(TIMEMAN_H_INCLUDED)
|
||||
#endif // #ifndef TIMEMAN_H_INCLUDED
|
||||
|
|
4
src/tt.h
4
src/tt.h
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(TT_H_INCLUDED)
|
||||
#ifndef TT_H_INCLUDED
|
||||
#define TT_H_INCLUDED
|
||||
|
||||
#include "misc.h"
|
||||
|
@ -115,4 +115,4 @@ inline void TranspositionTable::refresh(const TTEntry* tte) const {
|
|||
const_cast<TTEntry*>(tte)->set_generation(generation);
|
||||
}
|
||||
|
||||
#endif // !defined(TT_H_INCLUDED)
|
||||
#endif // #ifndef TT_H_INCLUDED
|
||||
|
|
10
src/types.h
10
src/types.h
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(TYPES_H_INCLUDED)
|
||||
#ifndef TYPES_H_INCLUDED
|
||||
#define TYPES_H_INCLUDED
|
||||
|
||||
/// For Linux and OSX configuration is done automatically using Makefile. To get
|
||||
|
@ -65,7 +65,7 @@
|
|||
# define CACHE_LINE_ALIGNMENT __attribute__ ((aligned(CACHE_LINE_SIZE)))
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
# define FORCE_INLINE __forceinline
|
||||
#elif defined(__GNUC__)
|
||||
# define FORCE_INLINE inline __attribute__((always_inline))
|
||||
|
@ -73,13 +73,13 @@
|
|||
# define FORCE_INLINE inline
|
||||
#endif
|
||||
|
||||
#if defined(USE_POPCNT)
|
||||
#ifdef USE_POPCNT
|
||||
const bool HasPopCnt = true;
|
||||
#else
|
||||
const bool HasPopCnt = false;
|
||||
#endif
|
||||
|
||||
#if defined(IS_64BIT)
|
||||
#ifdef IS_64BIT
|
||||
const bool Is64Bit = true;
|
||||
#else
|
||||
const bool Is64Bit = false;
|
||||
|
@ -440,4 +440,4 @@ inline const std::string square_to_string(Square s) {
|
|||
return ch;
|
||||
}
|
||||
|
||||
#endif // !defined(TYPES_H_INCLUDED)
|
||||
#endif // #ifndef TYPES_H_INCLUDED
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined(UCIOPTION_H_INCLUDED)
|
||||
#ifndef UCIOPTION_H_INCLUDED
|
||||
#define UCIOPTION_H_INCLUDED
|
||||
|
||||
#include <map>
|
||||
|
@ -66,4 +66,4 @@ void loop(const std::string&);
|
|||
|
||||
extern UCI::OptionsMap Options;
|
||||
|
||||
#endif // !defined(UCIOPTION_H_INCLUDED)
|
||||
#endif // #ifndef UCIOPTION_H_INCLUDED
|
||||
|
|
Loading…
Add table
Reference in a new issue