Skip to content

Commit

Permalink
Use optional for the engine path
Browse files Browse the repository at this point in the history
- A small quality of file change is to change the type of engine path
  from a string to an optional string, skips the binary directory
  lookup, which is commonly disabled by people who create wasm builds or
  include stockfish as a library.

closes official-stockfish#5575

No functional change
  • Loading branch information
Disservin committed Sep 9, 2024
1 parent a8cb002 commit effa246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ namespace NN = Eval::NNUE;
constexpr auto StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048;

Engine::Engine(std::string path) :
binaryDirectory(CommandLine::get_binary_directory(path)),
Engine::Engine(std::optional<std::string> path) :
binaryDirectory(path ? CommandLine::get_binary_directory(*path) : ""),
numaContext(NumaConfig::from_system()),
states(new std::deque<StateInfo>(1)),
threads(),
Expand Down
2 changes: 1 addition & 1 deletion src/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Engine {
using InfoFull = Search::InfoFull;
using InfoIter = Search::InfoIteration;

Engine(std::string path = "");
Engine(std::optional<std::string> path = std::nullopt);

// Cannot be movable due to components holding backreferences to fields
Engine(const Engine&) = delete;
Expand Down

0 comments on commit effa246

Please sign in to comment.