Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935221AbWKZBZQ (ORCPT ); Sat, 25 Nov 2006 20:25:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S935220AbWKZBZP (ORCPT ); Sat, 25 Nov 2006 20:25:15 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:12994 "EHLO ZenIV.linux.org.uk") by vger.kernel.org with ESMTP id S935221AbWKZBZO (ORCPT ); Sat, 25 Nov 2006 20:25:14 -0500 Date: Sun, 26 Nov 2006 01:25:11 +0000 From: Al Viro To: Roland Dreier Cc: David Miller , akpm@osdl.org, linux-kernel@vger.kernel.org, openib-general@openib.org, tom@opengridcomputing.com Subject: Re: [PATCH] Avoid truncating to 'long' in ALIGN() macro Message-ID: <20061126012511.GS3078@ftp.linux.org.uk> References: <20061124.220746.57445336.davem@davemloft.net> <20061125.150500.14841768.davem@davemloft.net> <20061126011014.GR3078@ftp.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 686 Lines: 16 On Sat, Nov 25, 2006 at 05:17:08PM -0800, Roland Dreier wrote: > > (typeof(x))((x + a - 1) & ~(a - 1ULL)) > > Yes I was being stupid thinking I needed a temporary variable to use > typeof. But what does the cast to typeof(x) accomplish if we write > things the way you suggested above? It seems that the right things is > really just > > (((x) + (a) - 1) & ~((typeof(x)) (a) - 1)) Better have type of result independent of that of a. - 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/