From bd0e4ceb857f3e7891e0d5aeebaa6e2144986ccb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 29 Apr 2009 01:52:28 +0200 Subject: macro: make pa_page_align roung up instead of down --- src/pulsecore/macro.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) -- cgit