Extract loops for adding/subtracting features into functions
passed STC: https://tests.stockfishchess.org/tests/view/6a662c7dc054e285ae028d31
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 89440 W: 23133 L: 22983 D: 43324
Ptnml(0-2): 210, 9236, 25655, 9432, 187
It uses always_inline and templates the sign to try to make sure that compilers won't emit calls or branches. It should generate almost identical code, but for some reason it is much faster on my computer.
```
Result of 60 runs (counting nodes/1B cycles)
=============================================
base (...tockfish.23cf5d) = 263302 +/- 5280
test (...tockfish.daacee) = 266324 +/- 5492
speedup % = +1.13 +/- 0.10
[95% CI; t-test]
likelihood(speedup > 0) = 1.0000
likelyhood(speedup > .5%) = 1.0000
CPU: 16 x Intel(R) Core(TM) Ultra 9 185H
```
Fishtest results (see also [[1]](https://tests.stockfishchess.org/tests/view/6a63f21ac054e285ae0288a2), [[2]](https://tests.stockfishchess.org/tests/view/6a6497e8c054e285ae028aac), [[3]](https://tests.stockfishchess.org/tests/view/6a64e0dfc054e285ae028b3e)) seem to suggest that this might be a sizable speedup on many machines, but also a sizable slowdown on some.
closes https://github.com/official-stockfish/Stockfish/pull/7013
No functional change