From owner-freebsd-current@FreeBSD.ORG Tue Apr 26 20:22:44 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA06B16A4EE for ; Tue, 26 Apr 2005 20:22:44 +0000 (GMT) Received: from 62-15-211-171.inversas.jazztel.es (62-15-211-171.inversas.jazztel.es [62.15.211.171]) by mx1.FreeBSD.org (Postfix) with ESMTP id DCC8543D39 for ; Tue, 26 Apr 2005 20:22:43 +0000 (GMT) (envelope-from josemi@freebsd.jazztel.es) Received: from redesjm.local (orion.redesjm.local [192.168.254.16]) j3QKMgkb022418; Tue, 26 Apr 2005 22:22:42 +0200 (CEST) (envelope-from josemi@redesjm.local) Received: from localhost (localhost [[UNIX: localhost]]) by redesjm.local (8.13.3/8.13.3/Submit) id j3QKMfNV004144; Tue, 26 Apr 2005 22:22:41 +0200 (CEST) (envelope-from josemi@redesjm.local) From: Jose M Rodriguez To: Marcel Moolenaar Date: Tue, 26 Apr 2005 22:22:40 +0200 User-Agent: KMail/1.8 References: <200504261143.55195.josemi@redesjm.local> <20050426194208.GB7773@ns1.xcllnt.net> In-Reply-To: <20050426194208.GB7773@ns1.xcllnt.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200504262222.41463.josemi@redesjm.local> X-AntiVirus: checked by AntiVir Milter (version: 1.1.0-3; AVE: 6.30.0.7; VDF: 6.30.0.116; host: antares.redesjm.local) cc: freebsd-current@freebsd.org cc: Jose M Rodriguez Subject: Re: rigth crc32 implementation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2005 20:22:44 -0000 El Martes, 26 de Abril de 2005 21:42, Marcel Moolenaar escribi=F3: > On Tue, Apr 26, 2005 at 11:43:54AM +0200, Jose M Rodriguez wrote: > > My first think was use the libkern based one, but I found: > > sys/linkern/crc32.c > > > > - the code may not be endian safe. > > It operates on bytes, so it's endian-safe. Note that the uint32_t > that's returned is not subject to endianness issues: it's always > in the native byte order. The caller of crc32 needs to byteswap > if it needs to compare this integral with a CRC that's not in > the native byte order. > Yes, but this code come from a previous reduction: calculate the table=20 from a xor/shift bit oriented alg. Looking at sys/net/if_ethersubr.c ether_crc32_be() & ether_crc32_le(), I=20 became to doubt if we need two tables, with bitesex based #ifs. =2D- josemi