From owner-cvs-all Mon Sep 25 13:48:31 2000 Delivered-To: cvs-all@freebsd.org Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25]) by hub.freebsd.org (Postfix) with SMTP id 014AA37B43E for ; Mon, 25 Sep 2000 13:48:27 -0700 (PDT) Received: (qmail 18031 invoked from network); 25 Sep 2000 20:48:23 -0000 Received: from unknown (HELO bde.zeta.org.au) (203.2.228.102) by gidora.zeta.org.au with SMTP; 25 Sep 2000 20:48:23 -0000 Date: Tue, 26 Sep 2000 07:48:17 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: "Justin T. Gibbs" Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys libkern.h In-Reply-To: <200009250629.XAA65780@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 24 Sep 2000, Justin T. Gibbs wrote: > gibbs 2000/09/24 23:29:16 PDT > > Modified files: (Branch: RELENG_4) > sys/sys libkern.h > Log: > MFC: Rev 1.23 - Add memset and memcpy as inline functions to bzero/bcopy. You mean memcmp and memset (memcpy was already a (non-inline) function). This mistake in -current shouldn't have been propagated. 1. The memcmp implementation is plain broken (memcmp can't be implemented using bcmp, since bcmp returns a boolean and memcmp returns a 3-way value). Only bcmp seems to be needed. 2. There was no need for memset to a nonzero value. Now, some functions in dev/randomdev may benefit from an optimized memset. The pessimized memset in libkern is no substitute. 3. Implementing memcpy is a an older mistake. It was supposed to be used if and only if the count is small and constant and their is no overlap (then the compiler builtin memcpy is better than the kernel bcopy). This should have been implemented by making bcopy inline (small constant counts can be detected at compile time, as in Linux's memcpy). It doesn't matter if the function is called bcopy or memcpy, but there should be only one version of it so that optimizations aren't wasted. (Actually, it does matter. bcopy is required to handle overlapping copies, so many of the optimizations for memcpy aren't valid for bcopy.) Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message