Read NNUE net faster

Load feature transformer weights in bulk on little-endian machines.
This is in particular useful to test new nets with c-chess-cli,
see https://github.com/lucasart/c-chess-cli/issues/44

```
$ time ./stockfish.exe uci

Before : 0m0.914s
After  : 0m0.483s
```

No functional change
This commit is contained in:
Tomasz Sobczyk
2021-06-09 11:21:55 +02:00
committed by Stéphane Nicolet
parent 559942d64d
commit b84fa04db6
4 changed files with 81 additions and 39 deletions

View File

@@ -105,9 +105,6 @@ template<> inline void swap_endian<uint8_t>(uint8_t&) {}
template<typename T, int LE> T number(void* addr)
{
static const union { uint32_t i; char c[4]; } Le = { 0x01020304 };
static const bool IsLittleEndian = (Le.c[0] == 4);
T v;
if ((uintptr_t)addr & (alignof(T) - 1)) // Unaligned pointer (very rare)