pointer: add align overload for pointer-views
This commit is contained in:
parent
35537b07ca
commit
89a28322ad
14
pointer.hpp
14
pointer.hpp
@ -17,6 +17,8 @@
|
||||
#ifndef CRUFT_UTIL_POINTER_HPP
|
||||
#define CRUFT_UTIL_POINTER_HPP
|
||||
|
||||
#include "view.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
@ -37,6 +39,18 @@ namespace util {
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename ValueT>
|
||||
constexpr util::view<ValueT*>
|
||||
align (util::view<ValueT*> value, size_t alignment)
|
||||
{
|
||||
return {
|
||||
align (value.begin (), alignment),
|
||||
value.end ()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
/// round the pointer upwards to satisfy the provided alignment
|
||||
constexpr inline uintptr_t
|
||||
|
Loading…
Reference in New Issue
Block a user