Added fast_float library as a replacement for std::from_chars and strtod.
This commit is contained in:
parent
e3ac2a9e45
commit
ad65366ac7
2449
src/fast_float/fast_float.h
Normal file
2449
src/fast_float/fast_float.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <charconv>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@ -10,6 +9,7 @@
|
||||
#include "LocalesUtils.hpp"
|
||||
|
||||
#include <Shiny/Shiny.h>
|
||||
#include <fast_float/fast_float.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@ -71,16 +71,9 @@ const char* GCodeReader::parse_line_internal(const char *ptr, const char *end, G
|
||||
}
|
||||
if (axis != NUM_AXES_WITH_UNKNOWN) {
|
||||
// Try to parse the numeric value.
|
||||
#ifdef WIN32
|
||||
double v;
|
||||
auto [pend, ec] = std::from_chars(++ c, end, v);
|
||||
auto [pend, ec] = fast_float::from_chars(++ c, end, v);
|
||||
if (pend != c && is_end_of_word(*pend)) {
|
||||
#else
|
||||
// The older version of GCC and Clang support std::from_chars just for integers, so strtod we used it instead.
|
||||
char *pend = nullptr;
|
||||
double v = strtod(++ c, &pend);
|
||||
if (pend != nullptr && is_end_of_word(*pend)) {
|
||||
#endif
|
||||
// The axis value has been parsed correctly.
|
||||
if (axis != UNKNOWN_AXIS)
|
||||
gline.m_axis[int(axis)] = float(v);
|
||||
|
@ -122,7 +122,9 @@ void CopyrightsDialog::fill_entries()
|
||||
{ "AppImage packaging for Linux using AppImageKit"
|
||||
, "2004-2019 Simon Peter and contributors" , "https://appimage.org/" },
|
||||
{ "lib_fts"
|
||||
, "Forrest Smith" , "https://www.forrestthewoods.com/" }
|
||||
, "Forrest Smith" , "https://www.forrestthewoods.com/" },
|
||||
{ "fast_float"
|
||||
, "Daniel Lemire, João Paulo Magalhaes and contributors", "https://github.com/fastfloat/fast_float" }
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user