> > > 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, [EMAIL PROTECTED] . 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 [EMAIL PROTECTED] with "unsubscribe freebsd-net" in the body of the message