File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ option(ENABLE_TESTS "Enable Unittests" ON)
99set (CMAKE_CXX_STANDARD 11)
1010set (CMAKE_CXX_STANDARD_REQUIRED True )
1111
12+ find_package (FastFloat REQUIRED)
13+
1214set (GCC_COMPILE_FLAGS "-Wextra -Wall -Wfloat-equal -Wundef -Wshadow \
1315-Wpointer-arith -Wcast-align -Wstrict-prototypes -Wwrite-strings \
1416-Waggregate-return -Wcast-qual -Wswitch-default -Wswitch-enum -Wconversion \
Original file line number Diff line number Diff line change 11#include < libdbc/exceptions/error.hpp>
22#include < libdbc/utils/utils.hpp>
33#include < libdbc/dbc.hpp>
4+ #include < fast_float/fast_float.h>
45
56#include < regex>
67
@@ -166,10 +167,14 @@ namespace libdbc {
166167 bool is_bigendian = (std::stoul (match.str (5 )) == 0 );
167168 bool is_signed = (match.str (6 ) == " -" );
168169 // Alternate groups because a group is for the decimal portion
169- double factor = std::stod (match.str (7 ));
170- double offset = std::stod (match.str (9 ));
171- double min = std::stod (match.str (11 ));
172- double max = std::stod (match.str (13 ));
170+ double factor;
171+ fast_float::from_chars (match.str (7 ).data (), match.str (7 ).data () + match.str (7 ).size (), factor);
172+ double offset;
173+ fast_float::from_chars (match.str (9 ).data (), match.str (9 ).data () + match.str (9 ).size (), offset);
174+ double min;
175+ fast_float::from_chars (match.str (11 ).data (), match.str (11 ).data () + match.str (11 ).size (), min);
176+ double max;
177+ fast_float::from_chars (match.str (13 ).data (), match.str (13 ).data () + match.str (13 ).size (), max);
173178 std::string unit = match.str (15 );
174179
175180 std::vector<std::string> receivers;
You can’t perform that action at this time.
0 commit comments