Date: Thu, 11 Oct 2001 11:35:29 -0700 (PDT) From: Luigi Rizzo <rizzo@aciri.org> To: mjacob@feral.com Cc: rizzo@aciri.org, freebsd-net@FreeBSD.ORG Subject: Re: review of change to bridge.h Message-ID: <200110111835.f9BIZTn12830@iguana.aciri.org> In-Reply-To: <20011011112700.T84793-100000@wonky.feral.com> from Matthew Jacob at "Oct 11, 2001 11:27:46 am"
next in thread | previous in thread | raw e-mail | index | archive | help
> > > On Thu, 11 Oct 2001, Luigi Rizzo wrote: > > > I guess it might be marginally more efficient to > > call bcmp() (and rely on it being optimized), or do 3 > > comparisons with unsigned short * > > > > > +#define IS_ETHER_BROADCAST(a) ( \ > > > + ((unsigned short *)(a))[0] == 0xffff && \ > > > + ((unsigned short *)(a))[1] == 0xffff && \ > > > + ((unsigned short *)(a))[2] == 0xffff) > > You can't assume a short * is aligned either. well, in this case a is always on an even boundary, but whether this is also a multiple of 4 is very driver-specific. Anyways, feel free to commit whatever version you prefer -- it is better than the current code anyways. I would probably use bcmp... i find myself trying to rely more and more on compiler optimizations, because the hand optimization that we all liked to do in the early years are very architecture specific and tend to become bad ideas as architectures evolve. There are parts of the code (e.g. in mbuf handling) where "optimized" versions of some routines (e.g. m_copym vs. m_copypacket) save maybe a couple of jumps/calls at the price of 500-1000 bytes of extra code (and associated cache pollution). cheers luigi ----------------------------------+----------------------------------------- Luigi RIZZO, luigi@iet.unipi.it . ACIRI/ICSI (on leave from Univ. di Pisa) http://www.iet.unipi.it/~luigi/ . 1947 Center St, Berkeley CA 94704 Phone: (510) 666 2927 ----------------------------------+----------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110111835.f9BIZTn12830>