build: 消除 make 编译警告 (GCC 10.2)
This commit is contained in:
parent
d89211f05d
commit
bd6396e459
|
@ -58,7 +58,7 @@
|
|||
|
||||
//#define FIRST_MOVE_STAR_PREFERRED
|
||||
|
||||
#define TIME_STAT
|
||||
//#define TIME_STAT
|
||||
//#define CYCLE_STAT
|
||||
|
||||
//#define SORT_MOVE_WITHOUT_HUMAN_KNOWLEDGES
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace CTSL //Concurrent Thread Safe Library
|
|||
|
||||
const K& getKey() const {return key;}
|
||||
void setValue(V value_) {value = value_;}
|
||||
const V& getValue() const {return value;}
|
||||
V& getValue() {return value;}
|
||||
void setKey(K key_) {key = key_;}
|
||||
|
||||
#ifndef DISABLE_HASHBUCKET
|
||||
|
|
|
@ -159,7 +159,7 @@ CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS)
|
|||
DEPENDFLAGS += -std=c++17
|
||||
LDFLAGS += $(EXTRALDFLAGS)
|
||||
|
||||
CXXFLAGS += -I../include -I.
|
||||
CXXFLAGS += -Wno-class-memaccess -I../include -I.
|
||||
|
||||
ifeq ($(COMP),)
|
||||
COMP=gcc
|
||||
|
|
|
@ -31,6 +31,6 @@ namespace Eval {
|
|||
std::string trace(Position &pos);
|
||||
|
||||
Value evaluate(Position &pos);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // #ifndef EVALUATE_H_INCLUDED
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace CTSL //Concurrent Thread Safe Library
|
|||
void prefetchValue(const K &key)
|
||||
{
|
||||
K hashValue = hashFn(key) & (hashSize - 1);
|
||||
const V *addr = &(hashTable[hashValue].getValue());
|
||||
V *addr = &(hashTable[hashValue].getValue());
|
||||
|
||||
prefetch((void *)addr);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ struct MoveList
|
|||
SQ_24, SQ_25, SQ_26, SQ_27, SQ_28, SQ_29, SQ_30, SQ_31,
|
||||
};
|
||||
|
||||
inline static Move moveTable[SQUARE_NB][MD_NB] = { {MOVE_NONE} };
|
||||
inline static Square moveTable[SQUARE_NB][MD_NB] = { {SQ_0} };
|
||||
|
||||
private:
|
||||
ExtMove moveList[MAX_MOVES], *last;
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
Position &pos;
|
||||
Move ttMove { MOVE_NONE };
|
||||
ExtMove *cur, *endMoves;
|
||||
ExtMove moves[MAX_MOVES] { MOVE_NONE };
|
||||
ExtMove moves[MAX_MOVES] { MOVE_NONE, 0 };
|
||||
|
||||
int moveCount{ 0 };
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ GameOptions gameOptions;
|
|||
void GameOptions::setAutoRestart(bool enabled)
|
||||
{
|
||||
isAutoRestart = enabled;
|
||||
};
|
||||
}
|
||||
|
||||
bool GameOptions::getAutoRestart()
|
||||
{
|
||||
|
|
|
@ -737,7 +737,7 @@ int Position::set_position(const struct Rule *newRule)
|
|||
bool Position::reset()
|
||||
{
|
||||
if (phase == PHASE_READY &&
|
||||
elapsedSeconds[BLACK] == elapsedSeconds[WHITE] == 0) {
|
||||
elapsedSeconds[BLACK] == 0 && elapsedSeconds[WHITE] == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ bool Position::resign(Color loser)
|
|||
|
||||
bool Position::command(const char *cmd)
|
||||
{
|
||||
int ruleIndex;
|
||||
unsigned int ruleIndex;
|
||||
unsigned t;
|
||||
int step;
|
||||
File file1, file2;
|
||||
|
@ -1072,18 +1072,18 @@ bool Position::command(const char *cmd)
|
|||
return set_position(&RULES[ruleIndex - 1]) >= 0 ? true : false;
|
||||
}
|
||||
|
||||
args = sscanf(cmd, "(%1u,%1u)->(%1u,%1u)", &file1, &rank1, &file2, &rank2);
|
||||
args = sscanf(cmd, "(%1u,%1u)->(%1u,%1u)", (unsigned*)&file1, (unsigned*)&rank1, (unsigned*)&file2, (unsigned*)&rank2);
|
||||
|
||||
if (args >= 4) {
|
||||
return move_piece(file1, rank1, file2, rank2);
|
||||
}
|
||||
|
||||
args = sscanf(cmd, "-(%1u,%1u)", &file1, &rank1);
|
||||
args = sscanf(cmd, "-(%1u,%1u)", (unsigned *)&file1, (unsigned *)&rank1);
|
||||
if (args >= 2) {
|
||||
return remove_piece(file1, rank1);
|
||||
}
|
||||
|
||||
args = sscanf(cmd, "(%1u,%1u)", &file1, &rank1);
|
||||
args = sscanf(cmd, "(%1u,%1u)", (unsigned *)&file1, (unsigned *)&rank1);
|
||||
if (args >= 2) {
|
||||
return put_piece(file1, rank1);
|
||||
}
|
||||
|
@ -1490,7 +1490,6 @@ int Position::in_how_many_mills(Square s, Color c, Square squareSelected)
|
|||
|
||||
int Position::add_mills(Square s)
|
||||
{
|
||||
uint64_t mill = 0;
|
||||
int n = 0;
|
||||
int idx[3], min, temp;
|
||||
Color m = color_on(s);
|
||||
|
@ -1525,13 +1524,6 @@ int Position::add_mills(Square s)
|
|||
idx[j] = temp;
|
||||
}
|
||||
|
||||
mill = (static_cast<uint64_t>(board[idx[0]]) << 40)
|
||||
+ (static_cast<uint64_t>(idx[0]) << 32)
|
||||
+ (static_cast<uint64_t>(board[idx[1]]) << 24)
|
||||
+ (static_cast<uint64_t>(idx[1]) << 16)
|
||||
+ (static_cast<uint64_t>(board[idx[2]]) << 8)
|
||||
+ static_cast<uint64_t>(idx[2]);
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
|
@ -1744,7 +1736,7 @@ void Position::mirror(vector <string> &cmdlist, bool cmdChange /*= true*/)
|
|||
}
|
||||
|
||||
if (cmdChange) {
|
||||
int r1, s1, r2, s2;
|
||||
unsigned r1, s1, r2, s2;
|
||||
int args = 0;
|
||||
|
||||
args = sscanf(cmdline, "(%1u,%1u)->(%1u,%1u)", &r1, &s1, &r2, &s2);
|
||||
|
@ -1869,7 +1861,7 @@ void Position::turn(vector <string> &cmdlist, bool cmdChange /*= true*/)
|
|||
|
||||
// 命令行解析
|
||||
if (cmdChange) {
|
||||
int r1, s1, r2, s2;
|
||||
unsigned r1, s1, r2, s2;
|
||||
int args = 0;
|
||||
|
||||
args = sscanf(cmdline, "(%1u,%1u)->(%1u,%1u)",
|
||||
|
@ -2048,7 +2040,7 @@ void Position::rotate(vector <string> &cmdlist, int degrees, bool cmdChange /*=
|
|||
}
|
||||
|
||||
if (cmdChange) {
|
||||
int r1, s1, r2, s2;
|
||||
unsigned r1, s1, r2, s2;
|
||||
int args = 0;
|
||||
|
||||
args = sscanf(cmdline, "(%1u,%1u)->(%1u,%1u)", &r1, &s1, &r2, &s2);
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
time_t start_timeb() const;
|
||||
void set_start_time(int stimeb);
|
||||
|
||||
Piece *get_board() const;
|
||||
Piece *get_board();
|
||||
Square current_square() const;
|
||||
enum Phase get_phase() const;
|
||||
enum Action get_action() const;
|
||||
|
@ -383,7 +383,7 @@ inline bool Position::move_piece(Square from, Square to)
|
|||
|
||||
/// Mill Game
|
||||
|
||||
inline Piece *Position::get_board() const
|
||||
inline Piece *Position::get_board()
|
||||
{
|
||||
return (Piece *)board;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ using namespace Search;
|
|||
|
||||
Value MTDF(Position *pos, Sanmill::Stack<Position> &ss, Value firstguess, Depth depth, Depth originDepth, Move &bestMove);
|
||||
|
||||
Value search(Position *pos, Sanmill::Stack<Position> &ss, Depth depth, Depth originDepth, Value alpha, Value beta, Move &bestMove);
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -126,8 +128,10 @@ int Thread::search()
|
|||
|
||||
MoveList<LEGAL>::shuffle();
|
||||
|
||||
#ifndef MTDF_AI
|
||||
Value alpha = -VALUE_INFINITE;
|
||||
Value beta = VALUE_INFINITE;
|
||||
#endif
|
||||
|
||||
if (gameOptions.getIDSEnabled()) {
|
||||
loggerDebug("IDS: ");
|
||||
|
@ -149,7 +153,7 @@ int Thread::search()
|
|||
#ifdef MTDF_AI
|
||||
value = MTDF(rootPos, ss, value, i, originDepth, bestMove);
|
||||
#else
|
||||
value = search(pos, ss, i, originDepth, alpha, beta, bestMove);
|
||||
value = search(rootPos, ss, i, originDepth, alpha, beta, bestMove);
|
||||
#endif
|
||||
|
||||
loggerDebug("%d(%d) ", value, value - lastValue);
|
||||
|
@ -159,7 +163,7 @@ int Thread::search()
|
|||
|
||||
#ifdef TIME_STAT
|
||||
timeEnd = chrono::steady_clock::now();
|
||||
loggerDebug("\nIDS Time: %llus\n", chrono::duration_cast<chrono::seconds>(timeEnd - timeStart).count());
|
||||
loggerDebug("\nIDS Time: %llds\n", chrono::duration_cast<chrono::seconds>(timeEnd - timeStart).count());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -169,17 +173,19 @@ int Thread::search()
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MTDF_AI
|
||||
if (gameOptions.getIDSEnabled()) {
|
||||
alpha = -VALUE_INFINITE;
|
||||
beta = VALUE_INFINITE;
|
||||
}
|
||||
#endif
|
||||
|
||||
originDepth = d;
|
||||
|
||||
#ifdef MTDF_AI
|
||||
value = MTDF(rootPos, ss, value, d, originDepth, bestMove);
|
||||
#else
|
||||
value = search(pos, ss, d, originDepth, alpha, beta, bestMove);
|
||||
value = search(rootPos, ss, d, originDepth, alpha, beta, bestMove);
|
||||
#endif
|
||||
|
||||
#ifdef TIME_STAT
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "config.h"
|
||||
#ifdef QT_UI
|
||||
#include <QObject>
|
||||
#endif QT_UI
|
||||
#endif // QT_UI
|
||||
|
||||
/// Thread class keeps together all the thread-related stuff. We use
|
||||
/// per-thread pawn and material hash tables so that once we get a
|
||||
|
|
|
@ -482,7 +482,7 @@ constexpr Square from_sq(Move m)
|
|||
return static_cast<Square>(m >> 8);
|
||||
}
|
||||
|
||||
inline const Square to_sq(Move m)
|
||||
constexpr Square to_sq(Move m)
|
||||
{
|
||||
if (m < 0)
|
||||
m = (Move)-m;
|
||||
|
@ -498,7 +498,7 @@ constexpr int from_to(Move m)
|
|||
return m & 0xFFFF; // TODO
|
||||
}
|
||||
|
||||
inline const MoveType type_of(Move m)
|
||||
constexpr MoveType type_of(Move m)
|
||||
{
|
||||
if (m < 0) {
|
||||
return MOVETYPE_REMOVE;
|
||||
|
@ -514,12 +514,12 @@ constexpr Move make_move(Square from, Square to)
|
|||
return Move((from << 8) + to);
|
||||
}
|
||||
|
||||
inline const Move reverse_move(Move m)
|
||||
constexpr Move reverse_move(Move m)
|
||||
{
|
||||
return make_move(to_sq(m), from_sq(m));
|
||||
}
|
||||
|
||||
static inline bool is_ok(Move m)
|
||||
constexpr bool is_ok(Move m)
|
||||
{
|
||||
return from_sq(m) != to_sq(m); // Catch MOVE_NULL and MOVE_NONE
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue