]> git.sesse.net Git - stockfish/blobdiff - src/nnue/nnue_common.h
Merge remote-tracking branch 'upstream/master'
[stockfish] / src / nnue / nnue_common.h
index f4c55e001e25d5a6806624ddc67cb9f9ecfb8207..4bc3408f18a2a469a69f6cc613f90268a4366505 100644 (file)
@@ -1,6 +1,6 @@
 /*
   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
-  Copyright (C) 2004-2023 The Stockfish developers (see AUTHORS file)
+  Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
 
   Stockfish is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -85,7 +85,7 @@ constexpr IntType ceil_to_multiple(IntType n, IntType base) {
 }
 
 
-// read_little_endian() is our utility to read an integer (signed or unsigned, any size)
+// Utility to read an integer (signed or unsigned, any size)
 // from a stream in little-endian order. We swap the byte order after the read if
 // necessary to return a result with the byte ordering of the compiling machine.
 template<typename IntType>
@@ -110,9 +110,9 @@ inline IntType read_little_endian(std::istream& stream) {
 }
 
 
-// write_little_endian() is our utility to write an integer (signed or unsigned, any size)
+// Utility to write an integer (signed or unsigned, any size)
 // to a stream in little-endian order. We swap the byte order before the write if
-// necessary to always write in little endian order, independently of the byte
+// necessary to always write in little-endian order, independently of the byte
 // ordering of the compiling machine.
 template<typename IntType>
 inline void write_little_endian(std::ostream& stream, IntType value) {
@@ -130,19 +130,19 @@ inline void write_little_endian(std::ostream& stream, IntType value) {
         {
             for (; i + 1 < sizeof(IntType); ++i)
             {
-                u[i] = (std::uint8_t) v;
+                u[i] = std::uint8_t(v);
                 v >>= 8;
             }
         }
-        u[i] = (std::uint8_t) v;
+        u[i] = std::uint8_t(v);
 
         stream.write(reinterpret_cast<char*>(u), sizeof(IntType));
     }
 }
 
 
-// read_little_endian(s, out, N) : read integers in bulk from a little indian stream.
-// This reads N integers from stream s and put them in array out.
+// Read integers in bulk from a little-endian stream.
+// This reads N integers from stream s and puts them in array out.
 template<typename IntType>
 inline void read_little_endian(std::istream& stream, IntType* out, std::size_t count) {
     if (IsLittleEndian)
@@ -153,7 +153,7 @@ inline void read_little_endian(std::istream& stream, IntType* out, std::size_t c
 }
 
 
-// write_little_endian(s, values, N) : write integers in bulk to a little indian stream.
+// Write integers in bulk to a little-endian stream.
 // This takes N integers from array values and writes them on stream s.
 template<typename IntType>
 inline void write_little_endian(std::ostream& stream, const IntType* values, std::size_t count) {
@@ -165,8 +165,8 @@ inline void write_little_endian(std::ostream& stream, const IntType* values, std
 }
 
 
-// read_leb_128(s, out, N) : read N signed integers from the stream s, putting them in
-// the array out. The stream is assumed to be compressed using the signed LEB128 format.
+// Read N signed integers from the stream s, putting them in the array out.
+// The stream is assumed to be compressed using the signed LEB128 format.
 // See https://en.wikipedia.org/wiki/LEB128 for a description of the compression scheme.
 template<typename IntType>
 inline void read_leb_128(std::istream& stream, IntType* out, std::size_t count) {
@@ -215,9 +215,9 @@ inline void read_leb_128(std::istream& stream, IntType* out, std::size_t count)
 }
 
 
-// write_leb_128(s, values, N) : write signed integers to a stream with LEB128 compression.
-// This takes N integers from array values, compress them with the LEB128 algorithm and
-// writes the result on the stream s.
+// Write signed integers to a stream with LEB128 compression.
+// This takes N integers from array values, compresses them with
+// the LEB128 algorithm and writes the result on the stream s.
 // See https://en.wikipedia.org/wiki/LEB128 for a description of the compression scheme.
 template<typename IntType>
 inline void write_leb_128(std::ostream& stream, const IntType* values, std::size_t count) {