mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 20:57:10 +00:00
Fix format
No functional change
This commit is contained in:
@@ -126,20 +126,15 @@ void init_threat_offsets() {
|
||||
}
|
||||
|
||||
// Index of a feature for a given king position and another piece on some square
|
||||
inline sf_always_inline
|
||||
IndexType FullThreats::make_index(Color perspective,
|
||||
Piece attacker,
|
||||
Square from,
|
||||
Square to,
|
||||
Piece attacked,
|
||||
Square ksq) {
|
||||
inline sf_always_inline IndexType FullThreats::make_index(
|
||||
Color perspective, Piece attacker, Square from, Square to, Piece attacked, Square ksq) {
|
||||
const int orientation = OrientTBL[perspective][ksq];
|
||||
from = Square(int(from) ^ orientation);
|
||||
to = Square(int(to) ^ orientation);
|
||||
from = Square(int(from) ^ orientation);
|
||||
to = Square(int(to) ^ orientation);
|
||||
|
||||
std::int8_t swap = 8 * perspective;
|
||||
attacker = Piece(attacker ^ swap);
|
||||
attacked = Piece(attacked ^ swap);
|
||||
attacker = Piece(attacker ^ swap);
|
||||
attacked = Piece(attacked ^ swap);
|
||||
|
||||
const auto piecePairData = index_lut1[attacker][attacked];
|
||||
|
||||
@@ -147,8 +142,8 @@ IndexType FullThreats::make_index(Color perspective,
|
||||
if ((piecePairData.excluded_pair_info() + less_than) & 2)
|
||||
return FullThreats::Dimensions;
|
||||
|
||||
const IndexType index = piecePairData.feature_index_base() + offsets[attacker][from]
|
||||
+ index_lut2[attacker][from][to];
|
||||
const IndexType index =
|
||||
piecePairData.feature_index_base() + offsets[attacker][from] + index_lut2[attacker][from][to];
|
||||
|
||||
sf_assume(index != FullThreats::Dimensions);
|
||||
return index;
|
||||
@@ -156,13 +151,11 @@ IndexType FullThreats::make_index(Color perspective,
|
||||
|
||||
// Get a list of indices for active features in ascending order
|
||||
|
||||
void FullThreats::append_active_indices(Color perspective,
|
||||
const Position& pos,
|
||||
IndexList& active) {
|
||||
void FullThreats::append_active_indices(Color perspective, const Position& pos, IndexList& active) {
|
||||
static constexpr Color order[2][2] = {{WHITE, BLACK}, {BLACK, WHITE}};
|
||||
|
||||
Square ksq = pos.square<KING>(perspective);
|
||||
Bitboard occupied = pos.pieces();
|
||||
Square ksq = pos.square<KING>(perspective);
|
||||
Bitboard occupied = pos.pieces();
|
||||
|
||||
for (Color color : {WHITE, BLACK})
|
||||
{
|
||||
@@ -186,7 +179,7 @@ void FullThreats::append_active_indices(Color perspective,
|
||||
Square to = pop_lsb(attacks_left);
|
||||
Square from = to - right;
|
||||
Piece attacked = pos.piece_on(to);
|
||||
IndexType index = make_index(perspective, attacker, from, to, attacked, ksq);
|
||||
IndexType index = make_index(perspective, attacker, from, to, attacked, ksq);
|
||||
|
||||
if (index < Dimensions)
|
||||
active.push_back(index);
|
||||
@@ -197,7 +190,7 @@ void FullThreats::append_active_indices(Color perspective,
|
||||
Square to = pop_lsb(attacks_right);
|
||||
Square from = to - left;
|
||||
Piece attacked = pos.piece_on(to);
|
||||
IndexType index = make_index(perspective, attacker, from, to, attacked, ksq);
|
||||
IndexType index = make_index(perspective, attacker, from, to, attacked, ksq);
|
||||
|
||||
if (index < Dimensions)
|
||||
active.push_back(index);
|
||||
@@ -214,8 +207,8 @@ void FullThreats::append_active_indices(Color perspective,
|
||||
{
|
||||
Square to = pop_lsb(attacks);
|
||||
Piece attacked = pos.piece_on(to);
|
||||
IndexType index = make_index(
|
||||
perspective, attacker, from, to, attacked, ksq);
|
||||
IndexType index =
|
||||
make_index(perspective, attacker, from, to, attacked, ksq);
|
||||
|
||||
if (index < Dimensions)
|
||||
active.push_back(index);
|
||||
@@ -275,8 +268,7 @@ void FullThreats::append_changed_indices(Color perspective,
|
||||
}
|
||||
}
|
||||
|
||||
const IndexType index = make_index(perspective,
|
||||
attacker, from, to, attacked, ksq);
|
||||
const IndexType index = make_index(perspective, attacker, from, to, attacked, ksq);
|
||||
|
||||
if (index < Dimensions)
|
||||
(add ? added : removed).push_back(index);
|
||||
|
||||
@@ -89,12 +89,8 @@ class FullThreats {
|
||||
using IndexList = ValueList<IndexType, MaxActiveDimensions>;
|
||||
using DiffType = DirtyThreats;
|
||||
|
||||
static IndexType make_index(Color perspective,
|
||||
Piece attkr,
|
||||
Square from,
|
||||
Square to,
|
||||
Piece attkd,
|
||||
Square ksq);
|
||||
static IndexType
|
||||
make_index(Color perspective, Piece attkr, Square from, Square to, Piece attkd, Square ksq);
|
||||
|
||||
// Get a list of indices for active features
|
||||
static void append_active_indices(Color perspective, const Position& pos, IndexList& active);
|
||||
|
||||
@@ -37,9 +37,7 @@ IndexType HalfKAv2_hm::make_index(Color perspective, Square s, Piece pc, Square
|
||||
|
||||
// Get a list of indices for active features
|
||||
|
||||
void HalfKAv2_hm::append_active_indices(Color perspective,
|
||||
const Position& pos,
|
||||
IndexList& active) {
|
||||
void HalfKAv2_hm::append_active_indices(Color perspective, const Position& pos, IndexList& active) {
|
||||
Square ksq = pos.square<KING>(perspective);
|
||||
Bitboard bb = pos.pieces();
|
||||
while (bb)
|
||||
@@ -51,11 +49,8 @@ void HalfKAv2_hm::append_active_indices(Color perspective,
|
||||
|
||||
// Get a list of indices for recently changed features
|
||||
|
||||
void HalfKAv2_hm::append_changed_indices(Color perspective,
|
||||
Square ksq,
|
||||
const DiffType& diff,
|
||||
IndexList& removed,
|
||||
IndexList& added) {
|
||||
void HalfKAv2_hm::append_changed_indices(
|
||||
Color perspective, Square ksq, const DiffType& diff, IndexList& removed, IndexList& added) {
|
||||
removed.push_back(make_index(perspective, diff.from, diff.pc, ksq));
|
||||
if (diff.to != SQ_NONE)
|
||||
added.push_back(make_index(perspective, diff.to, diff.pc, ksq));
|
||||
|
||||
@@ -112,16 +112,11 @@ class HalfKAv2_hm {
|
||||
|
||||
// Get a list of indices for active features
|
||||
|
||||
static void append_active_indices(Color perspective,
|
||||
const Position& pos,
|
||||
IndexList& active);
|
||||
static void append_active_indices(Color perspective, const Position& pos, IndexList& active);
|
||||
|
||||
// Get a list of indices for recently changed features
|
||||
static void append_changed_indices(Color perspective,
|
||||
Square ksq,
|
||||
const DiffType& diff,
|
||||
IndexList& removed,
|
||||
IndexList& added);
|
||||
static void append_changed_indices(
|
||||
Color perspective, Square ksq, const DiffType& diff, IndexList& removed, IndexList& added);
|
||||
|
||||
// Returns whether the change stored in this DirtyPiece means
|
||||
// that a full accumulator refresh is required.
|
||||
|
||||
@@ -41,7 +41,7 @@ using namespace SIMD;
|
||||
namespace {
|
||||
|
||||
template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<PSQFeatureSet>& middle_state,
|
||||
@@ -49,7 +49,7 @@ void double_inc_update(Color p
|
||||
const AccumulatorState<PSQFeatureSet>& computed);
|
||||
|
||||
template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<ThreatFeatureSet>& middle_state,
|
||||
@@ -57,9 +57,7 @@ void double_inc_update(Color p
|
||||
const AccumulatorState<ThreatFeatureSet>& computed,
|
||||
const DirtyPiece& dp2);
|
||||
|
||||
template<bool Forward,
|
||||
typename FeatureSet,
|
||||
IndexType TransformedFeatureDimensions>
|
||||
template<bool Forward, typename FeatureSet, IndexType TransformedFeatureDimensions>
|
||||
void update_accumulator_incremental(
|
||||
Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
@@ -68,14 +66,14 @@ void update_accumulator_incremental(
|
||||
const AccumulatorState<FeatureSet>& computed);
|
||||
|
||||
template<IndexType Dimensions>
|
||||
void update_accumulator_refresh_cache(Color perspective,
|
||||
void update_accumulator_refresh_cache(Color perspective,
|
||||
const FeatureTransformer<Dimensions>& featureTransformer,
|
||||
const Position& pos,
|
||||
AccumulatorState<PSQFeatureSet>& accumulatorState,
|
||||
AccumulatorCaches::Cache<Dimensions>& cache);
|
||||
|
||||
template<IndexType Dimensions>
|
||||
void update_threats_accumulator_full(Color perspective,
|
||||
void update_threats_accumulator_full(Color perspective,
|
||||
const FeatureTransformer<Dimensions>& featureTransformer,
|
||||
const Position& pos,
|
||||
AccumulatorState<ThreatFeatureSet>& accumulatorState);
|
||||
@@ -205,7 +203,7 @@ std::size_t AccumulatorStack::find_last_usable_accumulator(Color perspective) co
|
||||
|
||||
template<typename FeatureSet, IndexType Dimensions>
|
||||
void AccumulatorStack::forward_update_incremental(
|
||||
Color perspective,
|
||||
Color perspective,
|
||||
const Position& pos,
|
||||
const FeatureTransformer<Dimensions>& featureTransformer,
|
||||
const std::size_t begin) noexcept {
|
||||
@@ -260,7 +258,8 @@ void AccumulatorStack::forward_update_incremental(
|
||||
}
|
||||
|
||||
template<typename FeatureSet, IndexType Dimensions>
|
||||
void AccumulatorStack::backward_update_incremental(Color perspective,
|
||||
void AccumulatorStack::backward_update_incremental(
|
||||
Color perspective,
|
||||
|
||||
const Position& pos,
|
||||
const FeatureTransformer<Dimensions>& featureTransformer,
|
||||
@@ -479,16 +478,16 @@ struct AccumulatorUpdateContext {
|
||||
};
|
||||
|
||||
template<typename FeatureSet, IndexType Dimensions>
|
||||
auto make_accumulator_update_context(Color perspective,
|
||||
auto make_accumulator_update_context(Color perspective,
|
||||
const FeatureTransformer<Dimensions>& featureTransformer,
|
||||
const AccumulatorState<FeatureSet>& accumulatorFrom,
|
||||
AccumulatorState<FeatureSet>& accumulatorTo) noexcept {
|
||||
return AccumulatorUpdateContext<FeatureSet, Dimensions>{
|
||||
perspective, featureTransformer, accumulatorFrom, accumulatorTo};
|
||||
return AccumulatorUpdateContext<FeatureSet, Dimensions>{perspective, featureTransformer,
|
||||
accumulatorFrom, accumulatorTo};
|
||||
}
|
||||
|
||||
template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<PSQFeatureSet>& middle_state,
|
||||
@@ -532,8 +531,8 @@ void double_inc_update(Color p
|
||||
}
|
||||
|
||||
template<IndexType TransformedFeatureDimensions>
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
void double_inc_update(Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
const Square ksq,
|
||||
AccumulatorState<ThreatFeatureSet>& middle_state,
|
||||
AccumulatorState<ThreatFeatureSet>& target_state,
|
||||
@@ -562,9 +561,7 @@ const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
target_state.acc<TransformedFeatureDimensions>().computed[perspective] = true;
|
||||
}
|
||||
|
||||
template<bool Forward,
|
||||
typename FeatureSet,
|
||||
IndexType TransformedFeatureDimensions>
|
||||
template<bool Forward, typename FeatureSet, IndexType TransformedFeatureDimensions>
|
||||
void update_accumulator_incremental(
|
||||
Color perspective,
|
||||
const FeatureTransformer<TransformedFeatureDimensions>& featureTransformer,
|
||||
@@ -825,7 +822,7 @@ void update_accumulator_refresh_cache(Color pers
|
||||
}
|
||||
|
||||
template<IndexType Dimensions>
|
||||
void update_threats_accumulator_full(Color perspective,
|
||||
void update_threats_accumulator_full(Color perspective,
|
||||
const FeatureTransformer<Dimensions>& featureTransformer,
|
||||
const Position& pos,
|
||||
AccumulatorState<ThreatFeatureSet>& accumulatorState) {
|
||||
|
||||
Reference in New Issue
Block a user