Skip to content

Commit

Permalink
MinGW: Work around lack of strtof_l for locale independent parsing (#…
Browse files Browse the repository at this point in the history
…1697)

Signed-off-by: L. E. Segovia <amy@amyspark.me>

Signed-off-by: L. E. Segovia <amy@amyspark.me>
Co-authored-by: Doug Walker <doug.walker@autodesk.com>
  • Loading branch information
amyspark and doug-walker committed Oct 31, 2022
1 parent e7a88bf commit 1e6b01c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/NumberUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ really_inline from_chars_result from_chars(const char *first, const char *last,

float
#ifdef _WIN32
#if defined(__MINGW32__) || defined(__MINGW64__)
// MinGW doesn't define strtof_l (clang/gcc) nor strtod_l (gcc)...
tempval = static_cast<float>(_strtod_l (first, &endptr, loc.local));
#else
tempval = _strtof_l(first, &endptr, loc.local);
#endif
#elif __APPLE__
// On OSX, strtod_l is for some reason drastically faster than strtof_l.
tempval = static_cast<float>(::strtod_l(first, &endptr, loc.local));
Expand Down

0 comments on commit 1e6b01c

Please sign in to comment.