From owner-cvs-all Sat Jun 23 15: 1:39 2001 Delivered-To: cvs-all@freebsd.org Received: from ringworld.nanolink.com (diskworld.nanolink.com [195.24.48.189]) by hub.freebsd.org (Postfix) with SMTP id B928137B405 for ; Sat, 23 Jun 2001 15:01:27 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 8496 invoked by uid 1000); 23 Jun 2001 21:59:45 -0000 Date: Sun, 24 Jun 2001 00:59:45 +0300 From: Peter Pentchev To: Matt Dillon Cc: Mikhail Teterin , jlemon@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: Inline optimized bzero (was Re: cvs commit: src/sys/netinet tcp_subr.c) Message-ID: <20010624005945.E564@ringworld.oblivion.bg> Mail-Followup-To: Matt Dillon , Mikhail Teterin , jlemon@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG References: <200106231912.f5NJCUE01011@aldan.algebra.com> <200106232102.f5NL2fY73920@earth.backplane.com> <20010624003559.D564@ringworld.oblivion.bg> <200106232156.f5NLuu574208@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200106232156.f5NLuu574208@earth.backplane.com>; from dillon@earth.backplane.com on Sat, Jun 23, 2001 at 02:56:56PM -0700 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Jun 23, 2001 at 02:56:56PM -0700, Matt Dillon wrote: > > : > :Hi, > : > :Just a minor remark: this should either go in machine-dependent code, > :and really work on a size of the MD int type, or it should be called > :bzero32() or something, and work with int32_t. > : > :Other than that, yes, this looks like it would be a Good Thing(tm). > > It's machine independant... even if sizeof(int) changes. Or it should > be. Oops.. not quite. The 'bytes -= 4' should be > 'bytes -= sizeof(int)'. I'll fix that now. There... NOW it's > machine independant! > > The issue here is that in order to call bzerol() you have to know that > the pointer and size you are passing is at least integer-aligned > (whatever that size winds up being on the architecture). Since nearly > all structures in the system have an 'int', 'long', or pointer > declaration, they will be so-aligned and thus be compatible with > bzerol(). That was my point - but that's really for the programmer to decide. I guess there would be a big fat flashing warning 'do not use this unless you are not sure that your structure is int-aligned on all arches', and people would only call bzerol() if they are sure of that. > Calling bzerol() bzero32() makes no such guarentee, because > 'int' could very well be 64 bits and then bzero32() wouldn't be > sufficiently optimal. Yes, I see your point now. G'luck, Peter -- Thit sentence is not self-referential because "thit" is not a word. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message