summaryrefslogtreecommitdiffstats
path: root/vm/Common.h
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2011-02-08 20:10:56 -0800
committerCarl Shapiro <cshapiro@google.com>2011-02-08 20:10:56 -0800
commitcc3f8b43f6703a43bb3f48794c622b55f40402ad (patch)
treed0fe3857465bda98b8d2918be0231702932b1614 /vm/Common.h
parent8dcf274871fbce24f2891ddb05bdd8e5af2a53cd (diff)
downloadandroid_dalvik-cc3f8b43f6703a43bb3f48794c622b55f40402ad.tar.gz
android_dalvik-cc3f8b43f6703a43bb3f48794c622b55f40402ad.tar.bz2
android_dalvik-cc3f8b43f6703a43bb3f48794c622b55f40402ad.zip
Move the duplicated alignment macros to a common location.
Change-Id: I11cb1c3034a3a4e7d8e8c0793f5c85fa623155b2
Diffstat (limited to 'vm/Common.h')
-rw-r--r--vm/Common.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/vm/Common.h b/vm/Common.h
index 208ed2045..19de943d4 100644
--- a/vm/Common.h
+++ b/vm/Common.h
@@ -40,6 +40,11 @@
#define LIKELY(exp) (__builtin_expect((exp) != 0, true))
#define UNLIKELY(exp) (__builtin_expect((exp) != 0, false))
+#define ALIGN_UP(x, n) (((size_t)(x) + (n) - 1) & ~((n) - 1))
+#define ALIGN_DOWN(x, n) ((size_t)(x) & -(n))
+#define ALIGN_UP_TO_PAGE_SIZE(p) ALIGN_UP(p, SYSTEM_PAGE_SIZE)
+#define ALIGN_DOWN_TO_PAGE_SIZE(p) ALIGN_DOWN(p, SYSTEM_PAGE_SIZE)
+
/*
* If "very verbose" logging is enabled, make it equivalent to LOGV.
* Otherwise, make it disappear.