From f90fb3199d9343caebcabccc73fb2ac4e8635857 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 5 Dec 2018 02:07:05 -0500 Subject: [PATCH] avoid redefining PAGE_SIZE/PAGE_MASK --- pages.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pages.h b/pages.h index 7b49bec..672b30f 100644 --- a/pages.h +++ b/pages.h @@ -5,9 +5,10 @@ #include #define PAGE_SHIFT 12 +#ifndef PAGE_SIZE #define PAGE_SIZE ((size_t)1 << PAGE_SHIFT) -#define PAGE_MASK ((size_t)(PAGE_SIZE - 1)) -#define PAGE_CEILING(s) (((s) + PAGE_MASK) & ~PAGE_MASK) +#endif +#define PAGE_CEILING(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) void *allocate_pages(size_t usable_size, size_t guard_size, bool unprotect); void deallocate_pages(void *usable, size_t usable_size, size_t guard_size);