summaryrefslogtreecommitdiffstats
path: root/libc/private
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-06-13 13:57:51 -0700
committerChristopher Ferris <cferris@google.com>2014-06-18 14:23:46 -0700
commit03eebcb6e8762e668a0d3af6bb303cccb88c5b81 (patch)
tree3c5053d90eb3d1fac8c21fa390367a911e188191 /libc/private
parent64dfbd242cddc3ef95576e27e3940d68b89b5fce (diff)
downloadbionic-03eebcb6e8762e668a0d3af6bb303cccb88c5b81.zip
bionic-03eebcb6e8762e668a0d3af6bb303cccb88c5b81.tar.gz
bionic-03eebcb6e8762e668a0d3af6bb303cccb88c5b81.tar.bz2
Move common macros into bionic_macros.h.
Bug: 15590152 Change-Id: I730636613ef3653f68c5ab1d43b53beaf8e0dc25
Diffstat (limited to 'libc/private')
-rw-r--r--libc/private/bionic_macros.h6
-rw-r--r--libc/private/bionic_tls.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/libc/private/bionic_macros.h b/libc/private/bionic_macros.h
index 34da501..a3a6985 100644
--- a/libc/private/bionic_macros.h
+++ b/libc/private/bionic_macros.h
@@ -33,4 +33,10 @@
TypeName(); \
DISALLOW_COPY_AND_ASSIGN(TypeName)
+#define BIONIC_ALIGN(value, alignment) \
+ (((value) + (alignment) - 1) & ~((alignment) - 1))
+
+#define BIONIC_ROUND_UP_POWER_OF_2(value) \
+ (1UL << (sizeof(value) * 8 - 1 - __builtin_clz(value)))
+
#endif // _BIONIC_MACROS_H_
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index b52013f..56a61be 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -31,6 +31,7 @@
#include <sys/cdefs.h>
#include <sys/limits.h>
+#include "bionic_macros.h"
#include "__get_tls.h"
__BEGIN_DECLS
@@ -84,8 +85,6 @@ enum {
#define BIONIC_TLS_RESERVED_SLOTS GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT
#endif
-#define BIONIC_ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
-
/*
* Maximum number of elements in the TLS array.
* This includes space for pthread keys and our own internal slots.