From 3cde1560f6ed664d9b2e4e5910662fa993381156 Mon Sep 17 00:00:00 2001 From: mstembera <5421953+mstembera@users.noreply.github.com> Date: Wed, 4 Feb 2026 16:22:18 -0800 Subject: [PATCH] Minor fixes for MSVC closes https://github.com/official-stockfish/Stockfish/pull/6596 No functional change --- src/misc.h | 4 ++++ src/nnue/nnue_common.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/misc.h b/src/misc.h index 1471b1b6a..ff9d2c284 100644 --- a/src/misc.h +++ b/src/misc.h @@ -457,6 +457,8 @@ void move_to_front(std::vector& vec, Predicate pred) { __builtin_unreachable(); \ } while (0) #endif +#elif defined(_MSC_VER) + #define sf_assume(cond) __assume(cond) #else // do nothing for other compilers #define sf_assume(cond) @@ -464,6 +466,8 @@ void move_to_front(std::vector& vec, Predicate pred) { #ifdef __GNUC__ #define sf_unreachable() __builtin_unreachable() +#elif defined(_MSC_VER) + #define sf_unreachable() __assume(0) #else #define sf_unreachable() #endif diff --git a/src/nnue/nnue_common.h b/src/nnue/nnue_common.h index 27852ac7b..bd546d277 100644 --- a/src/nnue/nnue_common.h +++ b/src/nnue/nnue_common.h @@ -216,7 +216,7 @@ inline void read_leb_128(std::istream& stream, Arrays&... outs) { auto bytes_left = read_little_endian(stream); std::array buf; - std::uint32_t buf_pos = buf.size(); + std::uint32_t buf_pos = std::uint32_t(buf.size()); (read_leb_128_detail(stream, outs, bytes_left, buf, buf_pos), ...);