Skip to content

Commit 5b8f713

Browse files
committed
Fixed regression caused by unsigned integer underflow and added a test script
1 parent 9686d1d commit 5b8f713

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ namespace tt {
140140

141141
// Other accessors
142142
[[nodiscard]] inline Bound bound() const { return Bound(info.about & 3u); }
143-
[[nodiscard]] inline unsigned depth() const { return (info.about >> 2u) & 255u; }
143+
[[nodiscard]] inline int depth() const { return int((info.about >> 2u) & 255u); }
144144
[[nodiscard]] inline unsigned generation() const { return info.about >> 10u; }
145145
};
146146
static_assert(sizeof(entry_t) == 16);

test.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash -xe
2+
3+
cpus=$(nproc)
4+
threads=1
5+
concurrency=64
6+
cutechess_path=~/cutechess-cli
7+
syzygy_path=~/syzygy
8+
book_file=~/openings.pgn
9+
book_format=pgn;
10+
time_control="60+1"
11+
12+
commit_1=$1
13+
commit_2=$2
14+
15+
git fetch
16+
mkdir -p build
17+
18+
git checkout -- .
19+
git checkout "$commit_1"
20+
read -pr "$commit_1: press enter to continue: "
21+
cd build
22+
cmake ..
23+
make -j "$cpus" Topple
24+
mv Topple "$commit_1"
25+
cd ..
26+
27+
git checkout -- .
28+
git checkout "$commit_2"
29+
read -pr "$commit_2: press enter to continue: "
30+
cd build
31+
cmake ..
32+
make -j "$cpus" Topple
33+
mv Topple "$commit_2"
34+
cd ..
35+
36+
mkdir -p test
37+
cd test
38+
39+
$cutechess_path -openings file=$book_file format=$book_format order=sequential -repeat \
40+
-each dir=. option.Hash=512 option.Threads=$threads restart=on stderr=cutechess.log proto=uci tc=$time_control \
41+
-engine name="$commit_1" cmd=../build/"$commit_1" -engine name="$commit_2" cmd=../build/"$commit_2" \
42+
-concurrency $concurrency -games 10000 \
43+
-sprt elo0=0 elo1=5 alpha=0.1 beta=0.1 \
44+
-resign movecount=5 score=1000 \
45+
-draw movenumber=35 movecount=10 score=5 \
46+
-tb $syzygy_path

0 commit comments

Comments
 (0)