Replacing nested loops with a single range-based for loop

closes https://github.com/official-stockfish/Stockfish/pull/6503

No functional change
This commit is contained in:
FauziAkram
2026-01-01 16:12:35 +01:00
committed by Joost VandeVondele
parent 593eeaf24c
commit 5b9259e51f
+4 -9
View File
@@ -145,15 +145,10 @@ class FeatureTransformer {
} }
inline void scale_weights(bool read) { inline void scale_weights(bool read) {
for (IndexType j = 0; j < InputDimensions; ++j) for (auto& w : weights)
{ w = read ? w * 2 : w / 2;
WeightType* w = &weights[j * HalfDimensions]; for (auto& b : biases)
for (IndexType i = 0; i < HalfDimensions; ++i) b = read ? b * 2 : b / 2;
w[i] = read ? w[i] * 2 : w[i] / 2;
}
for (IndexType i = 0; i < HalfDimensions; ++i)
biases[i] = read ? biases[i] * 2 : biases[i] / 2;
} }
// Read network parameters // Read network parameters