Received: by taz.hyperreal.com (8.8.4/V2.0) id OAA26119; Tue, 18 Feb 1997 14:34:29 -0800 (PST) Received: from sierra.zyzzyva.com by taz.hyperreal.com (8.8.4/V2.0) with ESMTP id OAA26105; Tue, 18 Feb 1997 14:34:23 -0800 (PST) Received: from twinlark.arctic.org (twinlark.arctic.org [204.62.130.91]) by sierra.zyzzyva.com (8.8.4/8.8.2) with SMTP id QAA05914 for ; Tue, 18 Feb 1997 16:31:57 -0600 (CST) Received: (qmail 2520 invoked by uid 500); 18 Feb 1997 22:27:03 -0000 Date: Tue, 18 Feb 1997 14:27:02 -0800 (PST) From: Dean Gaudet To: new-httpd@hyperreal.com Subject: Re: [PATCH] murderous HUP In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com On Tue, 18 Feb 1997, Marc Slemko wrote: > Is there any reason to bother with a shift, or are compilers good enough > that they will implement multiplication by powers of two that way anyway? Yeah for any of the "easy" constants you can assume the compiler will optimize it for you. For others it's often not easy to decide when it's worth the extra registers required to pull some of the fancy constant multiplication tricks... not to mention the result code side-effects which might not let it pipeline, and so on. Powers of 2 should be easy on every modern CPU. And also, while I'm babbling away, since integer division instructions typically provide both the quotient and remainder as results some compilers will optimize "a/1000000" and "a%1000000" into a single instruction with two side-effects. gcc -O on i386 does this, haven't checked other architectures. ANSI C provides the div() and ldiv() library functions to presumably let the vendor provide this without the extra gear in the compiler. Another case of this is sin(t), cos(t) since it's easy to produce both at the same time, some FPUs have a "sincos" instruction. Dean