commit 762846a172e46a40204443f4e1b1512d4d46b25a
parent 920616026a17d5912882447bbdc1fc762b24b3f5
Author: sin <sin@2f30.org>
Date: Thu, 1 Aug 2013 16:36:07 +0100
Simplify rounding calculation
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/random/rballoc.c b/random/rballoc.c
@@ -90,8 +90,7 @@ mmap_pages(size_t siz)
{
void *addr;
- if (siz % PAGESIZE)
- siz = (siz + PAGESIZE) & ~(PAGESIZE - 1);
+ siz = PAGESIZE * ((siz + PAGESIZE - 1) / PAGESIZE);
addr = mmap(0, siz, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
if (addr == MAP_FAILED)