summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-04-29 01:52:28 +0200
committerLennart Poettering <lennart@poettering.net>2009-04-29 01:52:28 +0200
commitbd0e4ceb857f3e7891e0d5aeebaa6e2144986ccb (patch)
tree7f37f2b60f57a7a1e653cc87905d41e180810553
parent68f3ca9831a0ede7439348d0cd952f7730305bca (diff)
macro: make pa_page_align roung up instead of down
-rw-r--r--src/pulsecore/macro.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index 2f6ee90b..73438e64 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -75,8 +75,9 @@ static inline void* pa_page_align_ptr(const void *p) {
}
#define PA_PAGE_ALIGN_PTR(x) (pa_page_align_ptr(x))
+/* Rounds up */
static inline size_t pa_page_align(size_t l) {
- return l & ~(PA_PAGE_SIZE-1);
+ return ((l + PA_PAGE_SIZE - 1) / PA_PAGE_SIZE) * PA_PAGE_SIZE;
}
#define PA_PAGE_ALIGN(x) (pa_page_align(x))