NFC: add align_{down,up}<size_t>(address_t)
This commit is contained in:
committed by
Matthew Parkinson
parent
ebc02a141e
commit
5938f0b5a6
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user