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:
parent
f1bb4164bf
commit
86694b5914
1 changed files with 4 additions and 8 deletions
12
src/misc.cpp
12
src/misc.cpp
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue