macro: make pa_page_align roung up instead of down

This commit is contained in:
Lennart Poettering 2009-04-29 01:52:28 +02:00
parent 68f3ca9831
commit bd0e4ceb85

View file

@ -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))