[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B576F79.9020205@kernel.org>
Date: Wed, 20 Jan 2010 13:02:49 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Christoph Lameter <cl@...ux-foundation.org>
CC: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Jesse Barnes <jbarnes@...tuousgeek.org>,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH 22/37] move round_up/down to kernel.h
On 01/20/2010 12:52 PM, Christoph Lameter wrote:
> On Wed, 20 Jan 2010, Yinghai Lu wrote:
>
>> like this, using DIVIDE for all ?
>
> I liked the __round_mask better
how about if y is not pow_of_two ?
>
>
>> -#define __round_mask(x,y) ((__typeof__(x))((y)-1))
>> -#define round_up(x,y) ((((x)-1) | __round_mask(x,y))+1)
>> -#define round_down(x,y) ((x) & ~__round_mask(x,y))
>> +#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
>> +#define rounddown(x, y) (((x) / (y)) * (y))
>
>> +#define round_up(x,y) roundup(x,y)
>> +#define round_down(x,y) rounddown(x,y)
>
> Why two aliases? Make the use consistent throughout the source.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists