Generalize ROUND_UP() macro and introduce matching ROUND_UP_PTR()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2012-03-21 08:04:24 +11:00 committed by NeilBrown
parent 65ed615155
commit de89706515
1 changed files with 4 additions and 4 deletions

View File

@ -1252,10 +1252,10 @@ static inline int dev2minor(int d)
return (-1-d) << MdpMinorShift;
}
static inline int ROUND_UP(int a, int base)
{
return ((a+base-1)/base)*base;
}
#define _ROUND_UP(val, base) (((val) + (base)) & ~(base - 1))
#define ROUND_UP(val, base) _ROUND_UP(val, (typeof(val))(base))
#define ROUND_UP_PTR(ptr, base) ((typeof(ptr)) \
(ROUND_UP((unsigned long)(ptr), base)))
static inline int is_subarray(char *vers)
{