Draft patch for libstdc++/21209
Paolo Carlini
pcarlini@suse.de
Mon Apr 25 18:48:00 GMT 2005
Hi,
before proceeding with the final refiements, wanted to show you what I'm
preparing for this issue (i.e., *signed* integer overflow in
_M_extract_int). Basically, the idea is using *only* unsigned types in
the main parsing loop. In order to do that, I construct, via the
auxiliary template __to_unsigned_type, an unsigned type suited for each
signed type that we have to process (e.g., for long -> unsigned long),
then, at the end, I adjust the sign and assign the number to the "return
value" __v. Performance seems ok, even a tad (2-3%) faster than the
current code, and regression tests + some additional tests seems ok,
indeed. If nobody finds any serious flaw, I will go ahead along this
way, adding maybe a comment and a generic additional num_get testcase
exercising the parsing of numeric_limits<>::max and min.
Paolo.
///////////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_21209
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20050425/7044fb14/attachment.ksh>
More information about the Libstdc++
mailing list