From owner-freebsd-current Thu Jan 28 17:20:44 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA23606 for freebsd-current-outgoing; Thu, 28 Jan 1999 17:20:44 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.54]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA23600 for ; Thu, 28 Jan 1999 17:20:43 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.9.2/8.9.1) id RAA27878; Thu, 28 Jan 1999 17:22:01 -0800 (PST) (envelope-from sgk) From: Steve Kargl Message-Id: <199901290122.RAA27878@troutmask.apl.washington.edu> Subject: Re: indent(1) and style(9) (was: btokup() macro in sys/malloc.h) In-Reply-To: <199901290033.QAA12211@apollo.backplane.com> from Matthew Dillon at "Jan 28, 1999 4:33:12 pm" To: dillon@apollo.backplane.com (Matthew Dillon) Date: Thu, 28 Jan 1999 17:22:01 -0800 (PST) Cc: peter.jeremy@auss2.alcatel.com.au, current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matthew Dillon wrote: > :Luigi Rizzo > :>not speaking about vinum, but to me, the indentation of 8 char and > :... > : > :According to most of the coding standards I've read, readability > :(and hence maintainability) come before efficiency. That said, I > :agree that efficiency _is_ an issue within the kernel's critical > :paths (the TCP/IP code being one). > : > :Judicious use of inline functions (and macros) should help move > :code to the left - and may even make it more understandable. > : > :Peter > > More then judicious use -- inlines are an incredible advantage. Most > people don't realize that GCC will optimize constant arguments through > an inline call. Try this: > > static __inline Matt, int fubar(int c) { if (c & 1) ++c; if (c & 2) ++c; return(c); } void fubar2(void) { volatile int x; x = fubar(0); x = fubar(1); x = fubar(2); x = fubar(3); } % cc -S -O3 x.c % cat x.s fubar2: pushl %ebp movl %esp,%ebp subl $4,%esp xorl %eax,%eax <----- fubar (0) movl %eax,-4(%ebp) movl $3,-4(%ebp) <----- fubar (1) movl $3,-4(%ebp) <----- fubar (2) movl $4,-4(%ebp) <----- fubar (3) leave ret -- Steve finger kargl@troutmask.apl.washington.edu http://troutmask.apl.washington.edu/~clesceri/kargl.html To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message