This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] Print ints directly to streambuf
- From: Richard Henderson <rth at redhat dot com>
- To: Jerry Quinn <jlquinn at optonline dot net>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 25 Feb 2003 13:52:33 -0800
- Subject: Re: [v3] Print ints directly to streambuf
- References: <E18mSJY-00059v-00@tiamat>
On Sat, Feb 22, 2003 at 12:35:08AM -0500, Jerry Quinn wrote:
> + _M_estimate_length(_ValueT __v, const ios_base& __io, bool __neg) const
> + {
> + if (__builtin_expect((__io.flags() & ios_base::basefield) == ios_base::hex, false))
> + {
> + size_t __log16 = 1;
> + while ((__v >>= 4) != 0)
> + { ++__log16; }
(sizeof(__v)*CHAR_BIT - __builtin_clz(__v) + 3) / 4
? (Well, with __builtin_clz{,l,ll} chosen appropriately for the
type of __v.) You'd also need an early-out check for a zero input.
r~