From 5b9259e51fbf0231d2d97039f43590ff47a9d481 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 29 Dec 2025 00:51:10 +0300 Subject: [PATCH] Replacing nested loops with a single range-based for loop closes https://github.com/official-stockfish/Stockfish/pull/6503 No functional change --- src/nnue/nnue_feature_transformer.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/nnue/nnue_feature_transformer.h b/src/nnue/nnue_feature_transformer.h index ce23bdf0e..98b031f6b 100644 --- a/src/nnue/nnue_feature_transformer.h +++ b/src/nnue/nnue_feature_transformer.h @@ -145,15 +145,10 @@ class FeatureTransformer { } inline void scale_weights(bool read) { - for (IndexType j = 0; j < InputDimensions; ++j) - { - WeightType* w = &weights[j * HalfDimensions]; - for (IndexType i = 0; i < HalfDimensions; ++i) - 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; + for (auto& w : weights) + w = read ? w * 2 : w / 2; + for (auto& b : biases) + b = read ? b * 2 : b / 2; } // Read network parameters