diff --git a/maths.hpp b/maths.hpp index 8c7ca35b..9a9bfee8 100644 --- a/maths.hpp +++ b/maths.hpp @@ -90,7 +90,7 @@ rootsquare [[gnu::pure]] (T a, T b); // Rounding template typename std::common_type::type -align [[gnu::pure]] (T value, U size); +round_to [[gnu::pure]] (T value, U size); template diff --git a/maths.ipp b/maths.ipp index d2f11baa..7cddf28a 100644 --- a/maths.ipp +++ b/maths.ipp @@ -25,7 +25,7 @@ //----------------------------------------------------------------------------- template typename std::common_type::type -align (T value, U size) { +round_to (T value, U size) { static_assert (std::is_integral::value, "align requires integral types"); static_assert (std::is_integral::value, "align requires integral types"); diff --git a/memory/buffer/circular.cpp b/memory/buffer/circular.cpp index b3eca448..18067b52 100644 --- a/memory/buffer/circular.cpp +++ b/memory/buffer/circular.cpp @@ -58,7 +58,7 @@ tmpname (std::string &str, size_t length) circular::circular (size_t bytes) { bytes = max (bytes, sizeof (value_type)); - bytes = align (bytes, pagesize ()); + bytes = round_to (bytes, pagesize ()); int fd = -1; diff --git a/memory/buffer/paged.cpp b/memory/buffer/paged.cpp index 0f8a6589..f76734e5 100644 --- a/memory/buffer/paged.cpp +++ b/memory/buffer/paged.cpp @@ -29,7 +29,7 @@ using util::memory::buffer::paged; /////////////////////////////////////////////////////////////////////////////// paged::paged (size_t bytes, size_t _window): - m_window (align (_window, pagesize ())) + m_window (round_to (_window, pagesize ())) { // reserve the address region with no access permissions m_begin = reinterpret_cast ( @@ -40,7 +40,7 @@ paged::paged (size_t bytes, size_t _window): errno_error::throw_code (); // remap the initial window with read/write permissions - m_cursor = m_begin + align (min (m_window, bytes), pagesize ()); + m_cursor = m_begin + round_to (min (m_window, bytes), pagesize ()); if (MAP_FAILED == mmap (m_begin, m_cursor - m_begin, PROT_READ | PROT_WRITE, @@ -48,7 +48,7 @@ paged::paged (size_t bytes, size_t _window): errno_error::throw_code (); // record the nominal end address - m_end = m_begin + align (bytes, pagesize ()); + m_end = m_begin + round_to (bytes, pagesize ()); }