1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Replace std::from_chars with std::stoull

the former was not widely supported, requiring newer compiler versions.

closes https://github.com/official-stockfish/Stockfish/pull/5313

No functional change
This commit is contained in:
Tomasz Sobczyk 2024-05-30 18:18:51 +02:00 committed by Disservin
parent f1bb4164bf
commit 86694b5914

View file

@ -42,16 +42,15 @@ using AdjustTokenPrivileges_t =
#endif
#include <atomic>
#include <charconv>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <mutex>
#include <sstream>
#include <string_view>
#include <system_error>
#include "types.h"
@ -598,13 +597,10 @@ void aligned_large_pages_free(void* mem) { std_aligned_free(mem); }
#endif
size_t str_to_size_t(const std::string& s) {
size_t value;
auto result = std::from_chars(s.data(), s.data() + s.size(), value);
if (result.ec != std::errc())
unsigned long long value = std::stoull(s);
if (value > std::numeric_limits<size_t>::max())
std::exit(EXIT_FAILURE);
return value;
return static_cast<size_t>(value);
}
std::string CommandLine::get_binary_directory(std::string argv0) {