From owner-freebsd-net@FreeBSD.ORG Mon Aug 20 19:06:01 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0F1241065672 for ; Mon, 20 Aug 2012 19:06:01 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id C50DC8FC0C for ; Mon, 20 Aug 2012 19:06:00 +0000 (UTC) Received: by pbbrp2 with SMTP id rp2so7790364pbb.13 for ; Mon, 20 Aug 2012 12:05:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=FV6OYrlPxmmTMb7e2jr7yrc99awCVz+KDCbQ4Fh3tu8=; b=JNCHTshHTQbKmMBsGSs6UehqU5EQ9pKdx6GrkuWcxnGKCXIepPH0HXCL34sDUB5vCJ IU/oWSPIIOHzfy7ib04kK6AKIel+MG3WrHNsJFB2M/yGnc5Zv0hdLit4SlXRaHbjb/TE qKN7GSBxDmsvDqReK4Dx+5qO+lC0R+p0X7Lz7OmUrvpq8Yq+oszllfEYfhKdMdkRSF9A 3czVJ6cIqta40p+dOhhUE0wmNl/UC2483UmgLr4kJLAZOqJzcMZPffD2b1XBgUqp8XPe WAd2vjuZUCsz0fxd0ezDS8o7ZzQBx9Mz4dlMh1MwwQR0HdAtSoh4PSSfpEwG/yVrnB21 5fEg== Received: by 10.68.234.169 with SMTP id uf9mr29989923pbc.105.1345489554129; Mon, 20 Aug 2012 12:05:54 -0700 (PDT) Received: from monkey-bot.int.fusionio.com ([216.51.42.66]) by mx.google.com with ESMTPS id ka4sm6249974pbc.61.2012.08.20.12.05.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 20 Aug 2012 12:05:53 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Mon, 20 Aug 2012 13:05:51 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <50324DB4.6080905@cabletv.dp.ua> To: Wojciech Puchar X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQlexYRmCnhM7NaM8exhZRtyNWmdp3FeTy0Ie1z95bHcBU6klq/EttI60kO5bEQhh1IZJ4EO Cc: freebsd-hackers@freebsd.org, Mitya , freebsd-net@freebsd.org Subject: Re: Replace bcopy() to update ether_addr X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2012 19:06:01 -0000 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); >=20 > or use ++. >=20 > 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. Warner