Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 3 Oct 2002 12:06:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 3 Oct 2002 12:06:25 -0400 Received: from neon-gw-l3.transmeta.com ([63.209.4.196]:4881 "EHLO neon-gw.transmeta.com") by vger.kernel.org with ESMTP id ; Thu, 3 Oct 2002 12:06:24 -0400 Date: Thu, 3 Oct 2002 09:13:08 -0700 (PDT) From: Linus Torvalds To: Peter Chubb cc: Andreas Dilger , , Subject: Re: [PATCH] Large Block device patch part 3/4 In-Reply-To: <15772.7481.604681.575483@wombat.chubb.wattle.id.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1495 Lines: 34 On Thu, 3 Oct 2002, Peter Chubb wrote: > > No, because the purpose of the cast is to avoid dividing a 64-bit > quantity by an int. If you cast *after* the division, you still end > up doing a 64-bit division. Note that you could just use "do_div64()", which does a 64/32->64 division (which is a _hell_ of a lot faster than a generic 64/64 division, and it's a shame that gcc is too stupid to generate the right code directly - since it's trivially visible to the compiler when somebody does a 64/32 division). NOTE! do_div() has some rather strange but usefule calling conventions (it will change the 64-bit argument to be the result of the division, and the actual return value is the 32-bit modulus). Those are just because it ends up being the most convenient way to efficiently return both values. [ Explanation ] The reason Linux doesn't include libgcc.a is that gcc is totally braindead in some places, not because we don't like 64-bit divisions per se. Think of it as a "uhhuh, if gcc needed libgcc.a, then gcc did something truly horrible code generation" (and realize that quite often it is our fault, it's not just gcc doing stupid things. 99% of the time we can just simplify a division to a shift by hand, for example). Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/