PP: Implement locale-independent strtod, using istringstream and a fast path.
Fixes #1228. Fixes #234. This uses imbue() to be locale independent. Notes: - 'sstream >> double' is much slower than strtod() * this was measurable in the test suite as a whole, despite being a tiny fraction of what the test suite does - so, this embeds a fast path that bypasses sstream most of the time => the test suite is faster than before - sstream is probably slower, because it does more accurate rounding than strtod() - sstream does not create INFINITY by itself, this was done based on failure inferencing
This commit is contained in:
parent
6c52f8968c
commit
3e8e9f7bbd
3 changed files with 127 additions and 25 deletions
3
glslang/MachineIndependent/preprocessor/PpContext.cpp
Normal file → Executable file
3
glslang/MachineIndependent/preprocessor/PpContext.cpp
Normal file → Executable file
|
|
@ -77,6 +77,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
\****************************************************************************/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <locale>
|
||||
|
||||
#include "PpContext.h"
|
||||
|
||||
|
|
@ -91,6 +92,8 @@ TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, T
|
|||
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
|
||||
elseSeen[elsetracker] = false;
|
||||
elsetracker = 0;
|
||||
|
||||
strtodStream.imbue(std::locale::classic());
|
||||
}
|
||||
|
||||
TPpContext::~TPpContext()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue