Closed lucasart closed 5 years ago
This is not really a bug, in fact:
assert(idx < 4096);
return -SafetyCurve[idx & 4095]; /* idx shouldn't exceed 4095, but just in case, prevent overflow,
while not taxing performance (min(idx, 4096) is slow because it adds a branch).*/
The logic is:
Smaller repro:
position fen 1B4Q1/8/2N5/5k2/4n3/3Q3p/7P/6RK b - - 0
eval
. B . . . . Q .
. . . . . . . .
. . N . . . . .
. . . . . k . .
. . . . n . . .
. . . Q . . . p
. . . . . . . P
. . . . . . R K
1B4Q1/8/2N5/5k2/4n3/3Q3p/7P/6RK b - - 0
demolito: ./src/eval.c:229: int safety(const Position *, int, bitboard_t (*)[7]): Assertion `idx < 4096' failed.
Aborted (core dumped)
Reproduction still quite complex:
make CF=-std=gnu11\ -O1
.<
to demolito.