This is the mail archive of the
mailing list for the libstdc++ project.
Re: [v3] Print ints directly to streambuf
On Fri, Mar 07, 2003 at 10:31:21PM -0500, Jerry Quinn wrote:
> Benjamin Kosnik writes:
> > Can you update this to use __builtin_clz as suggested by Richard?
> Sure. From the discussion, it sounds like it's worth having this
> ifdef'd by the platforms on which it's a win. Richard listed x86,
> ppc, alphaev67, arm, and ia64.
Possibly we could work up a "test whether this function generates out-of-line
code" autoconf macro. That would adjust itself to the platform, and let
> Can I do something like
> #ifdef __i386__ || __powerpc__ || __alphaev67__ || __arm__ || __ia64__
> so other targets still get a reasonable inline implementation?
Limiting the use of __builtin_clz here is probably a good idea. But we'd
rather not do ifdefs on platforms directly in the code. Usually this is
done via autoconf macros or the platform-specific os_defines.h (I know,
it's not an OS thang in this case.)
> Mainly, I'm not sure what macros I can count on.
That's one of the reasons we try to not use them directly in v3 code.
FWIW, given a "cpu-vendor-os" configuration triplet, __cpu__ and __os__
are usually predefined.
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams