[Patch] Fix libstdc++/13341 (speed-up <wchar_t>::do_narrow/widen)

Jerry Quinn jlquinn@optonline.net
Fri Dec 12 04:07:00 GMT 2003


Paolo Carlini writes:
 >     wchar_t
 >     ctype<wchar_t>::
 >     do_widen(char __c) const
 > !   { 
 > !     wchar_t __ret;
 > !     const unsigned char __uc = static_cast<unsigned char>(__c);
 > !     if (__uc < 128)
 > !       __ret = _M_widen[__uc];
 > !     else
 > !       __ret = btowc(__uc);
 > !     return __ret;
 > !   }

Why not cache all 256 widen chars rather than just 128?  We already
know all the source possibilities, unlike in do_narrow().

Jerry Quinn



More information about the Libstdc++ mailing list