25#include <seastar/util/modules.hh>
32SEASTAR_MODULE_EXPORT_BEGIN
36T align_up(T v, T align) {
37 return (v + align - 1) & ~(align - 1);
42T* align_up(T* v,
size_t align) {
43 static_assert(
sizeof(T) == 1,
"align byte pointers only");
44 return reinterpret_cast<T*
>(align_up(
reinterpret_cast<uintptr_t
>(v), align));
49T align_down(T v, T align) {
50 return v & ~(align - 1);
55T* align_down(T* v,
size_t align) {
56 static_assert(
sizeof(T) == 1,
"align byte pointers only");
57 return reinterpret_cast<T*
>(align_down(
reinterpret_cast<uintptr_t
>(v), align));
60SEASTAR_MODULE_EXPORT_END
Seastar API namespace.
Definition: abort_on_ebadf.hh:26