Move common macros into bionic_macros.h.
Bug: 15590152
Change-Id: I730636613ef3653f68c5ab1d43b53beaf8e0dc25
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 @@
#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.