From: Lennart Poettering Date: Tue, 28 Apr 2009 23:52:28 +0000 (+0200) Subject: macro: make pa_page_align roung up instead of down X-Git-Tag: submit/2.0-panda/20130828.192557~1850 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd0e4ceb857f3e7891e0d5aeebaa6e2144986ccb;p=profile%2Fivi%2Fpulseaudio-panda.git macro: make pa_page_align roung up instead of down --- diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h index 2f6ee90..73438e6 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))