This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] Fix libstdc++/13341 (speed-up <wchar_t>::do_narrow/widen)
- From: Jerry Quinn <jlquinn at optonline dot net>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 11 Dec 2003 23:00:40 -0500
- Subject: [Patch] Fix libstdc++/13341 (speed-up <wchar_t>::do_narrow/widen)
- References: <3FD89A30.50103@suse.de>
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