diff options
author | Elliott Hughes <enh@google.com> | 2013-12-12 15:31:35 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2013-12-12 15:31:35 -0800 |
commit | c2f082f65528a889aca7cde4b343aaf36199ba82 (patch) | |
tree | 5a25b53321b7dc3ecef8e241eb07133df30eb5b3 /libc/include/sys/param.h | |
parent | 5aad083f3de0bbcc0ffb1fecb688fbbe5abe5214 (diff) | |
download | bionic-c2f082f65528a889aca7cde4b343aaf36199ba82.zip bionic-c2f082f65528a889aca7cde4b343aaf36199ba82.tar.gz bionic-c2f082f65528a889aca7cde4b343aaf36199ba82.tar.bz2 |
Make <sys/param.h> more glibc-like.
In particular, add MAX and MIN, needed by elfutils.
Bug: 11864683
Change-Id: I1b876732cdf68cdf5b930319e5ef5b5647586718
Diffstat (limited to 'libc/include/sys/param.h')
-rw-r--r-- | libc/include/sys/param.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libc/include/sys/param.h b/libc/include/sys/param.h index 27acd70..37c6427 100644 --- a/libc/include/sys/param.h +++ b/libc/include/sys/param.h @@ -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 + +/* 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) -#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_ */ |