From 5938f0b5a64bcb0f7d9dc03de6ca42315dd9e168 Mon Sep 17 00:00:00 2001 From: Nathaniel Filardo Date: Thu, 11 Mar 2021 17:23:30 +0000 Subject: [PATCH] NFC: add align_{down,up}(address_t) --- src/ds/address.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ds/address.h b/src/ds/address.h index 4622d2a..399b1b0 100644 --- a/src/ds/address.h +++ b/src/ds/address.h @@ -76,6 +76,12 @@ namespace snmalloc } } + template + inline address_t address_align_down(address_t p) + { + return bits::align_down(p, alignment); + } + /** * Align a pointer up to a statically specified granularity, which must be a * power of two. @@ -98,6 +104,12 @@ namespace snmalloc } } + template + inline address_t address_align_up(address_t p) + { + return bits::align_up(p, alignment); + } + /** * Align a pointer down to a dynamically specified granularity, which must be * a power of two.