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>
(cherry picked from commit 1e6b01c)
  • Loading branch information
amyspark authored and cedrik-fuoco-adsk committed Jan 5, 2023
1 parent 704bcf8 commit ffeda7d
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 ffeda7d

Please sign in to comment.