lkml.org 
[lkml]   [2010]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 25/35] move round_up/down to kernel.h
From
Date
On Wed, 2010-02-10 at 01:20 -0800, Yinghai Lu wrote:
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 1221d23..7f07074 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -44,6 +44,16 @@ extern const char linux_proc_banner[];
[]
> +#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 FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
> #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))

Having both roundup and round_up in kernel.h is a
near guarantee for a future incorrect use.

Can't you use a different name for this?



\
 
 \ /
  Last update: 2010-02-13 19:51    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site