On Fri, 27 Oct 2000, Ruslan Ermilov wrote:

> On Fri, Oct 27, 2000 at 06:11:49PM +0300, Ruslan Ermilov wrote:
> > On Fri, Oct 27, 2000 at 07:34:06AM -0700, Mike Smith wrote:
> > > > +#ifdef __OPTIMIZE__
> > > 
> > > Using macros does not "optimise" anything,

Not quite true.  Using inline functions pessimizes everything that is
compiled without -O since the functions don't get inlined but code
for them is generated in each object file whether or not they are
used.  <sys/types.h> is included a lot, so having inline functions in
it is especially pessimal for the -O0 case.

> > >   and this is a very poor choice 
> > > of defines.  __MACRO_ENDIAN_CONVERSIONS might be better.

__OPTIMIZE__ is the standard gcc macro for telling whether gcc has been
invoked with -O.  It is used sort of backwards here.  There is no reason
to turn off the macros for constants, but turning off the inlines for
non-constants would fix the useless bloat in the -O0 case.

Is the htonl() family used enough on constants for the constant case to
be worth optimizing?

Writing the byte swapping using shifts and masks might be best in all
cases.  The compiler can in theory reduce shifts and masks to bswap on
i386's if that is best, but it can't look inside asm statements.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to