This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 00/11] Improve generic string routines
On Mon, 19 Dec 2016, Richard Henderson wrote:
> > * Rather than hardcoding unsigned long int as the word type to use, it
> > would be better to have another sysdeps header where architectures can
> > choose the type to use for this purpose, so that ILP32 configurations with
> > 64-bit registers can use unsigned long long int instead. (E.g. there
> > aren't many MIPS-specific string functions, so MIPS n32 would benefit from
> > using 64-bit integers here.)
>
> Since my strcmp uses memcopy.h for MERGE, perhaps the op_t that's already
> defined in there? Or...
gmp-mparam.h is also similar in spirit (i.e. something that should be
overridden to be optimal in cases of 64-bit registers with ILP32). Maybe
there should be a common internal header to declare register size (default
__WORDSIZE = size of long), which gmp-mparam.h could use to define other
macros (possibly avoiding the need for architecture-specific versions of
that header) and which could also be used for defining the type used in
string functions?
> Is there a preference for or against many little headers, like I was using, or
> a larger header using ifdefs to allow an architecture to override specific
> portions, like Ondrej was using?
>
> Given our recent-ish preference for avoiding #ifdef in favor of #if, I really
> don't know which is more preferable.
I prefer little headers that avoid #ifdef. (The only way in which those
fail to be typo-proof is if you typo the header name itself and so have an
unused architecture-specific file.)
--
Joseph S. Myers
joseph@codesourcery.com