Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Hejl <hejl.lukas@gmail.com>2021-09-09 16:25:14 +0300
committerLukáš Hejl <hejl.lukas@gmail.com>2021-09-11 01:54:30 +0300
commitad65366ac7c4a8fa527bf87369d781029c858ee4 (patch)
tree1bb5e96f80dd834c1b9865d0c8f52b4438e201a1 /src/libslic3r/GCodeReader.cpp
parente3ac2a9e4556c766a636d876f00c03190ee5b41f (diff)
Added fast_float library as a replacement for std::from_chars and strtod.
Diffstat (limited to 'src/libslic3r/GCodeReader.cpp')
-rw-r--r--src/libslic3r/GCodeReader.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/libslic3r/GCodeReader.cpp b/src/libslic3r/GCodeReader.cpp
index 4c4bebee4..61ab10f22 100644
--- a/src/libslic3r/GCodeReader.cpp
+++ b/src/libslic3r/GCodeReader.cpp
@@ -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);