Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935352AbWKZVG6 (ORCPT ); Sun, 26 Nov 2006 16:06:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S935562AbWKZVG6 (ORCPT ); Sun, 26 Nov 2006 16:06:58 -0500 Received: from wohnheim.fh-wedel.de ([213.39.233.138]:12498 "EHLO wohnheim.fh-wedel.de") by vger.kernel.org with ESMTP id S935352AbWKZVG5 (ORCPT ); Sun, 26 Nov 2006 16:06:57 -0500 Date: Sun, 26 Nov 2006 22:06:12 +0100 From: =?iso-8859-1?Q?J=F6rn?= Engel To: Roland Dreier Cc: Linus Torvalds , Andrew Morton , David Miller , linux-kernel@vger.kernel.org, openib-general@openib.org, tom@opengridcomputing.com, Al Viro Subject: Re: [PATCH] Avoid truncating to 'long' in ALIGN() macro Message-ID: <20061126210612.GD6807@wohnheim.fh-wedel.de> References: <20061124.220746.57445336.davem@davemloft.net> <20061125.150500.14841768.davem@davemloft.net> <20061125164118.de53d1cf.akpm@osdl.org> <20061126111703.33247a84.akpm@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 925 Lines: 25 On Sun, 26 November 2006 12:26:08 -0800, Roland Dreier wrote: > > > +#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) > > +#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) > > Fine by me, but it loses the extra (typeof(x)) cast that Al wanted to > make sure that the result of ALIGN() is not wider than x. Not a big deal, is it? #define ALIGN(x,a) (typeof(x))__ALIGN_MASK(x,(typeof(x))(a)-1) #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) J?rn -- Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats. -- Howard Aiken quoted by Ken Iverson quoted by Jim Horning quoted by Raph Levien, 1979 - 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/