mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Use int conversion for Option class
The current implementation generates warnings on MSVC. However, we have no real use cases for double-typed UCI option values now. Also parameter tuning only accepts following three types: int, Value, Score closes https://github.com/official-stockfish/Stockfish/pull/4505 No functional change
This commit is contained in:
parent
5d258e168f
commit
6e63dd63a4
3 changed files with 5 additions and 5 deletions
|
@ -87,7 +87,7 @@ void TranspositionTable::clear() {
|
||||||
|
|
||||||
std::vector<std::thread> threads;
|
std::vector<std::thread> threads;
|
||||||
|
|
||||||
for (size_t idx = 0; idx < Options["Threads"]; ++idx)
|
for (size_t idx = 0; idx < size_t(Options["Threads"]); ++idx)
|
||||||
{
|
{
|
||||||
threads.emplace_back([this, idx]() {
|
threads.emplace_back([this, idx]() {
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void TranspositionTable::clear() {
|
||||||
// Each thread will zero its part of the hash table
|
// Each thread will zero its part of the hash table
|
||||||
const size_t stride = size_t(clusterCount / Options["Threads"]),
|
const size_t stride = size_t(clusterCount / Options["Threads"]),
|
||||||
start = size_t(stride * idx),
|
start = size_t(stride * idx),
|
||||||
len = idx != Options["Threads"] - 1 ?
|
len = idx != size_t(Options["Threads"]) - 1 ?
|
||||||
stride : clusterCount - start;
|
stride : clusterCount - start;
|
||||||
|
|
||||||
std::memset(&table[start], 0, len * sizeof(Cluster));
|
std::memset(&table[start], 0, len * sizeof(Cluster));
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
Option& operator=(const std::string&);
|
Option& operator=(const std::string&);
|
||||||
void operator<<(const Option&);
|
void operator<<(const Option&);
|
||||||
operator double() const;
|
operator int() const;
|
||||||
operator std::string() const;
|
operator std::string() const;
|
||||||
bool operator==(const char*) const;
|
bool operator==(const char*) const;
|
||||||
|
|
||||||
|
|
|
@ -128,9 +128,9 @@ Option::Option(double v, int minv, int maxv, OnChange f) : type("spin"), min(min
|
||||||
Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f)
|
Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f)
|
||||||
{ defaultValue = v; currentValue = cur; }
|
{ defaultValue = v; currentValue = cur; }
|
||||||
|
|
||||||
Option::operator double() const {
|
Option::operator int() const {
|
||||||
assert(type == "check" || type == "spin");
|
assert(type == "check" || type == "spin");
|
||||||
return (type == "spin" ? stof(currentValue) : currentValue == "true");
|
return (type == "spin" ? std::stoi(currentValue) : currentValue == "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
Option::operator std::string() const {
|
Option::operator std::string() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue