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:
parent
65ed615155
commit
de89706515
8
mdadm.h
8
mdadm.h
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue