Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Aug 2012 18:48:39 +0200 (CEST)
From:      Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
To:        Mitya <mitya@cabletv.dp.ua>
Cc:        freebsd-hackers@freebsd.org, freebsd-net@freebsd.org
Subject:   Re: Replace bcopy() to update ether_addr
Message-ID:  <alpine.BSF.2.00.1208201844220.35173@wojtek.tensor.gdynia.pl>
In-Reply-To: <50324DB4.6080905@cabletv.dp.ua>
References:  <50324DB4.6080905@cabletv.dp.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
> #if defined(__i386__) || defined(__amd64__)
>    *dst = *src;
> #else
>    bcopy(src, dst, ETHER_ADDR_LEN);
#else
short *tmp1=((*short)src),*tmp2=((*short)dst);
*tmp2=*tmp1; *(tmp2+1)=*(tmp1+1); *(tmp2+2)=*(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.



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