Skip to content

Commit d25d035

Browse files
committed
apply some clang-tidy advices
1 parent fc450f3 commit d25d035

File tree

7 files changed

+21
-41
lines changed

7 files changed

+21
-41
lines changed

src/Application.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
2-
APP_PLATFORM := android-14
2+
APP_PLATFORM := android-16
33
APP_BUILD_SCRIPT := Android.mk
4+
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
5+
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384" # Android NDK r26 or earlier
6+
LOCAL_LDFLAGS += "-Wl,-z,common-page-size=16384" # Android NDK r22 or earlier

src/base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ void base_unique(Base *base)
739739
*/
740740
bool base_load(Base *base, const char *file)
741741
{
742-
void (*load)(Game*, FILE*) = game_import_text;
742+
void (*load)(Game*, FILE*);
743743
Game game;
744744
FILE *f;
745745
char ext[8];
@@ -787,7 +787,7 @@ bool base_load(Base *base, const char *file)
787787
*/
788788
void base_save(const Base *base, const char *file)
789789
{
790-
void (*save)(const Game*, FILE*)= game_export_text;
790+
void (*save)(const Game*, FILE*);
791791
FILE *f;
792792
char ext[8];
793793
int i, l;

src/bench.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ static void bench_move_generator(void)
5858
double t, t_mean, t_var, t_min, t_max;
5959

6060
v = 0;
61-
c = -click();
6261
for (i = 0; i < N_WARMUP; ++i) {
6362
v += i;
6463
}
65-
c += click();
6664

6765
c = -click();
6866
for (i = 0; i < N_REPEAT; ++i) {
@@ -79,12 +77,10 @@ static void bench_move_generator(void)
7977
board_set(&board, b);
8078
board.player &= ~x_to_bit(x);
8179
board.opponent &= ~x_to_bit(x);
82-
83-
c = -click();
80+
8481
for (i = 0; i < N_WARMUP; ++i) {
8582
v += board_get_move_flip(&board, x, &move);
8683
}
87-
c += click();
8884

8985
c = -click();
9086
for (i = 0; i < N_REPEAT; ++i) {
@@ -125,11 +121,9 @@ static void bench_count_last_flip(void)
125121

126122
v = 0;
127123

128-
c = -click();
129124
for (i = 0; i < N_WARMUP; ++i) {
130125
v += i;
131126
}
132-
c += click();
133127

134128
c = -click();
135129
for (i = 0; i < N_REPEAT; ++i) {
@@ -147,11 +141,9 @@ static void bench_count_last_flip(void)
147141
board.player &= ~x_to_bit(x);
148142
// board.opponent &= ~x_to_bit(x);
149143

150-
c = -click();
151144
for (i = 0; i < N_WARMUP; ++i) {
152145
v += last_flip(x, board.player & ~i);
153146
}
154-
c += click();
155147

156148
c = -click();
157149
for (i = 0; i < N_REPEAT; ++i) {
@@ -193,11 +185,9 @@ static void bench_solve_1(void)
193185
board_set(&board, b);
194186
v = 0;
195187

196-
c = -click();
197188
for (i = 0; i < N_WARMUP; ++i) {
198189
v += i;
199190
}
200-
c += click();
201191

202192
c = -click();
203193
for (i = 0; i < N_REPEAT; ++i) {
@@ -215,11 +205,9 @@ static void bench_solve_1(void)
215205
board.player &= ~x_to_bit(x);
216206
board.opponent &= ~x_to_bit(x);
217207

218-
c = -click();
219208
for (i = 0; i < N_WARMUP; ++i) {
220209
v += solve_1(board.player, SCORE_MAX - 1, x);
221210
}
222-
c += click();
223211

224212
c = -click();
225213
for (i = 0; i < N_REPEAT; ++i) {
@@ -260,13 +248,11 @@ static void bench_mobility(void)
260248

261249
board_set(&board, b);
262250
v = 0;
263-
c = -click();
264251
for (i = 0; i < N_WARMUP; ++i) {
265252
board.player &= ~i;
266253
board.opponent &= ~i;
267254
v += i;
268255
}
269-
c += click();
270256

271257
board_set(&board, b);
272258
c = -click();
@@ -276,7 +262,7 @@ static void bench_mobility(void)
276262
v += i;
277263
}
278264
c += click();
279-
overhead = 0;
265+
overhead = c;
280266

281267
t_mean = t_var = 0.0;
282268
t_max = 0;
@@ -286,14 +272,12 @@ static void bench_mobility(void)
286272
board_set(&board, b);
287273

288274
v = 0;
289-
c = -click();
290275
for (i = 0; i < N_WARMUP; ++i) {
291276
board.player &= ~i;
292277
board.opponent &= ~i;
293278
v += get_mobility(board.player, board.opponent);
294279
v -= get_mobility(board.opponent, board.player);
295280
}
296-
c += click();
297281

298282
board_set(&board, b);
299283
c = -click();
@@ -340,12 +324,10 @@ static void bench_stability(void)
340324

341325
v = 0;
342326
x = A1;
343-
c = -click();
344327
for (i = 0; i < N_WARMUP; ++i) {
345328
board.player &= ~x_to_bit(x);
346329
board.opponent &= ~x_to_bit(x);
347330
}
348-
c += click();
349331

350332
board_set(&board, b);
351333
c = -click();
@@ -362,15 +344,12 @@ static void bench_stability(void)
362344

363345
for (x = A1; x < PASS; ++x) {
364346
board_set(&board, b);
365-
366347
v = 0;
367-
c = -click();
368348
for (i = 0; i < N_WARMUP; ++i) {
369349
board.player &= ~x_to_bit(x);
370350
board.opponent &= ~x_to_bit(x);
371351
v += get_stability(board.player, board.opponent);
372352
}
373-
c += click();
374353

375354
board_set(&board, b);
376355
c = -click();

src/book.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,6 @@ void book_play(Book *book)
18571857

18581858
file_add_ext(options.book_file, ".play", file);
18591859
do {
1860-
n_diffs = 0;
18611860
book->stats.n_nodes = book->stats.n_links = book->stats.n_todo = 0;
18621861
foreach_position(p, a, book) {
18631862
if (p->n_link == 0 && board_count_empties(&p->board) >= book->options.n_empties && !board_is_game_over(&p->board)) {

src/options.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ Options options = {
2626

2727
1, // n_task (will be set to system available cpus at run-time)
2828
false, // cpu_affinity
29+
true, // can ponder
30+
31+
false, // all_best
2932

3033
1, // verbosity
3134
0, // noise
@@ -35,10 +38,9 @@ Options options = {
3538
false, // debug cassio
3639
true, // transgress cassio
3740

38-
21, // max level
3941
TIME_MAX, // infinite time
42+
21, // max level
4043
EDAX_FIXED_LEVEL, // play-type
41-
true, // can ponder
4244
-1, // depth
4345
-1, // selectivity
4446

@@ -50,8 +52,6 @@ Options options = {
5052
SCORE_MIN, // alpha
5153
SCORE_MAX, // beta
5254

53-
false, // all_best
54-
5555
NULL, // evaluation function's weights file.
5656

5757
NULL, // book file
@@ -64,10 +64,10 @@ Options options = {
6464
NULL, // port
6565
1, // open
6666

67-
0.25, // probcut depth reduction (/2)
6867
false, // pv debug
6968
false, // pv check
7069
false, // pv guess
70+
0.25, // probcut depth reduction (/2)
7171

7272
NULL, // game file.
7373

@@ -411,4 +411,3 @@ void options_free(void)
411411
free(options.book_file);
412412
free(options.eval_file);
413413
}
414-

src/options.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,21 @@ typedef struct {
2828

2929
int n_task; /**< search in parallel, using n_tasks */
3030
bool cpu_affinity; /**< set one cpu/thread to diminish context change */
31+
bool can_ponder; /**< pondering on/off */
32+
33+
bool all_best; /**< search for all best moves when solving problem */
3134

3235
int verbosity; /**< search display */
33-
int noise; /**< search display min depth */
36+
int noise; /**< search display min depth */
3437
int width; /**< line width */
3538
bool echo; /**< repeat user input */
3639
bool info; /**< info display */
3740
bool debug_cassio; /**< display debug info in cassio's "fenetre de rapport"*/
3841
bool transgress_cassio; /**< adapt Cassio requests to search & solve faster */
3942

40-
int level; /**< level */
4143
long long time; /**< time in sec. */
44+
int level; /**< level */
4245
PlayType play_type; /**< game|move-time switch */
43-
bool can_ponder; /**< pondering on/off */
4446
int depth; /**< depth (only for testing) */
4547
int selectivity; /**< selectivity (only for testing) */
4648

@@ -52,8 +54,6 @@ typedef struct {
5254
int alpha; /**< alpha bound */
5355
int beta; /**< beta bound */
5456

55-
bool all_best; /**< search for all best moves when solving problem */
56-
5757
char *eval_file; /**< evaluation file */
5858

5959
char *book_file; /**< opening book filename */
@@ -66,12 +66,12 @@ typedef struct {
6666
char *ggs_port; /**< ggs port */
6767
bool ggs_open; /**< ggs open number (set it false for tournaments) */
6868

69-
double probcut_d;
70-
7169
bool pv_debug; /**< debug PV */
7270
bool pv_check; /**< check PV correctness */
7371
bool pv_guess; /**< guess PV missing moves */
7472

73+
double probcut_d;
74+
7575
char *game_file; /**< game file */
7676

7777
char *search_log_file; /**< log file (for search) */

src/perft.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ static void boardcache_append(BoardCache *hash, const Board *b)
697697
l = board_count_empties(hash->array + i); j = i;
698698
k = board_count_empties(hash->array + ++i); if (k > l) {l = k; j = i;}
699699
k = board_count_empties(hash->array + ++i); if (k > l) {l = k; j = i;}
700-
k = board_count_empties(hash->array + ++i); if (k > l) {l = k; j = i;}
700+
k = board_count_empties(hash->array + ++i); if (k > l) {j = i;}
701701

702702
hash->array[j] = u;
703703
}

0 commit comments

Comments
 (0)