Date: Thu, 11 Oct 2001 11:42:30 -0700 (PDT) From: Matthew Jacob <mjacob@feral.com> To: Luigi Rizzo <rizzo@aciri.org> Cc: <freebsd-net@FreeBSD.ORG> Subject: Re: review of change to bridge.h Message-ID: <20011011114158.G84793-100000@wonky.feral.com> In-Reply-To: <200110111835.f9BIZTn12830@iguana.aciri.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Maybe bcmp is right. I believe having IS_ETHER_BROADCAST is too useful a macro.... On Thu, 11 Oct 2001, Luigi Rizzo wrote: > > > > > > 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?20011011114158.G84793-100000>