Merge pull request #191 from nwf/aal-address_t

Allow the AAL to define address_t
This commit is contained in:
Matthew Parkinson
2020-05-23 08:26:29 +01:00
committed by GitHub
3 changed files with 29 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ namespace snmalloc
* separated into two types, one for raw addresses and one for addresses that
* can be cast back to pointers.
*/
using address_t = uintptr_t;
using address_t = Aal::address_t;
/**
* Perform pointer arithmetic and return the adjusted pointer.
@@ -51,8 +51,7 @@ namespace snmalloc
{
static_assert(bits::next_pow2_const(alignment) == alignment);
return ((static_cast<size_t>(address_cast(p)) | size) & (alignment - 1)) ==
0;
return ((address_cast(p) | size) & (alignment - 1)) == 0;
}
/**

View File

@@ -17,7 +17,7 @@ namespace snmalloc
* are always the same, invalid pointer values with different sentinels are
* always different.
*/
template<uintptr_t OtherSentinel>
template<address_t OtherSentinel>
constexpr bool operator==(const InvalidPointer<OtherSentinel>&)
{
return Sentinel == OtherSentinel;
@@ -27,7 +27,7 @@ namespace snmalloc
* are always the same, invalid pointer values with different sentinels are
* always different.
*/
template<uintptr_t OtherSentinel>
template<address_t OtherSentinel>
constexpr bool operator!=(const InvalidPointer<OtherSentinel>&)
{
return Sentinel != OtherSentinel;