aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/round_up_to_page_size.cpp
blob: 80b28d7e0274d5e3ab542bf13b951d9c3914e1d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "round_up_to_page_size.h"
#include <unistd.h>

namespace vespalib {

namespace {

const size_t page_size = getpagesize();

}

size_t round_up_to_page_size(size_t size)
{
    return ((size + (page_size - 1)) & ~(page_size - 1));
}

}