[Patch] Fix num_get::do_get(bool&) vs 22.2.2.1.2, p16

Paolo Carlini pcarlini@suse.de
Sun Dec 14 09:27:00 GMT 2003


Hi,

this is pretty obvious on the basis of the standard.

I didn't really benchmark, but, besides the correctness issue,
probably the final result is faster since, as soon as the initial
part of truename or falsename stops to match we now stop comparing
its chars to *__beg and, typically, one of the two stops quite
early (e.g., 'true'/'false' compared to 'false'/'true', respectively).
I.e., from:

  if (__n <= __fn)
    __testf = __traits_type::eq(*__beg, __lc->_M_falsename[__n]);

to, now:

  if (__testf && __n <= __fn)
    __testf = __traits_type::eq(*__beg, __lc->_M_falsename[__n]);

Tested x86-linux. Will commit on monday.

Paolo.

/////////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_get_bool
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031214/77f5236c/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_get_bool
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031214/77f5236c/attachment-0001.ksh>


More information about the Libstdc++ mailing list