lkml.org 
[lkml]   [2010]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.



\
 
 \ /
  Last update: 2010-01-20 22:05    [W:0.429 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site