NFC: add align_{down,up}<size_t>(address_t)

This commit is contained in:
Nathaniel Filardo
2021-03-11 17:23:30 +00:00
committed by Matthew Parkinson
parent ebc02a141e
commit 5938f0b5a6

View File

@@ -76,6 +76,12 @@ namespace snmalloc
}
}
template<size_t alignment>
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<size_t alignment>
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.