diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-09-20 10:37:46 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-09-20 10:43:38 -0700 |
commit | ec0c9c5561785299d0c03ed05fe94e0031ba6487 (patch) | |
tree | d419f86bde522652621677dd3b45c0c54241cfaa /tests/test.cpp | |
parent | bda55c818c0936fe5e41e381794018f0fc60b1a3 (diff) |
Implement custom string to integer conversion
This makes conversion significantly faster and removes more CRT dependencies;
in particular, to support long long pugixml only requires the type itself (and
the division operator...).
New implementation is up to 3x faster on short decimal numbers.
Note that unlike the old implementation, new implementation correctly handles
overflow and underflow and clamps the value to the representable range. This
means that there are some behavior changes - e.g. previously as_uint on "-1"
would return INT_MAX instead of 0.
In addition to CRT issues, for platforms with 64-bit long old implementation
incorrectly truncated from long to int or unsigned int, so even if CRT clamped
the values the result would have been incorrect.
Diffstat (limited to 'tests/test.cpp')
0 files changed, 0 insertions, 0 deletions