Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967192AbWKZBKU (ORCPT ); Sat, 25 Nov 2006 20:10:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S967196AbWKZBKU (ORCPT ); Sat, 25 Nov 2006 20:10:20 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:49091 "EHLO ZenIV.linux.org.uk") by vger.kernel.org with ESMTP id S967192AbWKZBKT (ORCPT ); Sat, 25 Nov 2006 20:10:19 -0500 Date: Sun, 26 Nov 2006 01:10:14 +0000 From: Al Viro To: David Miller Cc: rdreier@cisco.com, 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: <20061126011014.GR3078@ftp.linux.org.uk> References: <20061124.220746.57445336.davem@davemloft.net> <20061125.150500.14841768.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061125.150500.14841768.davem@davemloft.net> User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 820 Lines: 27 On Sat, Nov 25, 2006 at 03:05:00PM -0800, David Miller wrote: > From: Roland Dreier > Date: Sat, 25 Nov 2006 14:56:22 -0800 > > > > Perhaps a better way to fix this is to use > > > typeof() like other similar macros do. > > > > I tried doing > > > > #define ALIGN(x,a) \ > > ({ \ > > typeof(x) _a = (a); \ > > ((x) + _a - 1) & ~(_a - 1); \ > > }) > > > > but that won't compile because of : > > You would need to also cast the constants with typeof() to. Oh, for fsck sake... (typeof(x))((x + a - 1) & ~(a - 1ULL)) - 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/