Make <sys/param.h> more glibc-like.

In particular, add MAX and MIN, needed by elfutils.

Bug: 11864683
Change-Id: I1b876732cdf68cdf5b930319e5ef5b5647586718
This commit is contained in:
Elliott Hughes 2013-12-12 15:31:35 -08:00
parent 5aad083f3d
commit c2f082f655

View File

@ -40,8 +40,19 @@
#define ALIGNBYTES 3
#endif
#define ALIGN(p) (((unsigned long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#ifndef ALIGN
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#endif
#define powerof2(x) ((((x)-1)&(x))==0)
/* Macros for counting and rounding. */
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
#define powerof2(x) ((((x)-1)&(x))==0)
/* Macros for min/max. */
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif /* _SYS_PARAM_H_ */