Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Aug 2012 12:20:32 -0700
From:      Bakul Shah <bakul@bitblocks.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        freebsd-hackers@freebsd.org, freebsd-net@freebsd.org
Subject:   Re: Replace bcopy() to update ether_addr 
Message-ID:  <20120820192032.C8F24B827@mail.bitblocks.com>
In-Reply-To: Your message of "Mon, 20 Aug 2012 13:05:51 MDT." <B2BB7724-57A9-40C9-AE9F-FFEC83D9DE9A@bsdimp.com> 
References:  <50324DB4.6080905@cabletv.dp.ua> <alpine.BSF.2.00.1208201844220.35173@wojtek.tensor.gdynia.pl> <B2BB7724-57A9-40C9-AE9F-FFEC83D9DE9A@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 20 Aug 2012 13:05:51 MDT Warner Losh <imp@bsdimp.com>  wrote:
> 
> On Aug 20, 2012, at 10:48 AM, Wojciech Puchar wrote:
> 
> >> #if defined(__i386__) || defined(__amd64__)
> >>   *dst =3D *src;
> >> #else
> >>   bcopy(src, dst, ETHER_ADDR_LEN);
> > #else
> > short *tmp1=3D((*short)src),*tmp2=3D((*short)dst);
> > *tmp2=3D*tmp1; *(tmp2+1)=3D*(tmp1+1); *(tmp2+2)=3D*(tmp1+2);
> >
> > or use ++.
> >
> > i think it is always aligned to 2 bytes and this should produce usable
> code on any CPU? should be 6 instructions on MIPS and PPC IMHO.
> 
> We should tag it as __aligned(2) then, no?  If so, then the compiler
> should generate the code you posted.

Doesn't gcc inline memcpy these days? 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120820192032.C8F24B827>