From owner-cvs-all@FreeBSD.ORG Thu Mar 10 08:18:09 2005 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B18816A4CE; Thu, 10 Mar 2005 08:18:09 +0000 (GMT) Received: from pd3mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 37AE243D46; Thu, 10 Mar 2005 08:18:09 +0000 (GMT) (envelope-from cperciva@freebsd.org) Received: from pd4mr4so.prod.shaw.ca (pd4mr4so-qfe3.prod.shaw.ca [10.0.141.215]) by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0ID40000NN28CTB0@l-daemon>; Thu, 10 Mar 2005 01:18:08 -0700 (MST) Received: from pn2ml4so.prod.shaw.ca ([10.0.121.148]) by pd4mr4so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0ID400GTDN285GD0@pd4mr4so.prod.shaw.ca>; Thu, 10 Mar 2005 01:18:08 -0700 (MST) Received: from [192.168.0.60] (S0106006067227a4a.vc.shawcable.net [24.87.209.6]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0ID400GAVN28DT@l-daemon>; Thu, 10 Mar 2005 01:18:08 -0700 (MST) Date: Thu, 10 Mar 2005 00:18:07 -0800 From: Colin Percival In-reply-to: <20050310065547.GA16318@cirb503493.alcatel.com.au> To: Peter Jeremy Message-id: <423002BF.5010202@freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime References: <200503091923.j29JN4Ti063868@repoman.freebsd.org> <422F50A6.907@criticalmagic.com> <422F55C6.3000207@freebsd.org> <20050310065547.GA16318@cirb503493.alcatel.com.au> User-Agent: Mozilla Thunderbird 1.0 (X11/20050302) cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libmd Makefile sha256.3 sha256.h sha256c.c shadriver.c src/sbin/md5 Makefile md5.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2005 08:18:09 -0000 Peter Jeremy wrote: > Three almost, > but not totally, identical versions of foo() means three times as much > maintenance effort and a non-zero probability of someone forgetting > to make a change to one of the versions. Absolutely -- but this isn't particularly relevant for hash functions, since hash functions don't get upgraded to newer versions or have new features added. (Ok, they do, but they get a new name and the old versions are left unchanged.) >> These hash >>functions are designed for 32-bit processors in a manner which makes it >>fairly hard for the compiler to get things wrong. > > It's not so much getting things wrong as being able to get the right > answer quicker. It may not be obvious to the compiler that > a = (a << 5) | (a >> 27); > can be replaced by > rotl a,5 It is obvious to the compiler. That's a very common idiom and one of the first things that compilers recognize. Gcc gets this right, and I doubt many people are going to be using a compiler which is worse at optimization than gcc. Colin Percival