Better reciprocal division and modulus.
The previous reciprocal division branch on the prime that the sizeclass
was constructed from. All sizeclasses can be represented as
2^n * {1,3,5,7}
This lead to a very small table, but some work to calculate the
appropriate shifts and multiplications to implement reciprocal division.
This commit uses a completely uniform representation for every
sizeclass using a lookup table. Due to the precise ranges that we query
the modulus and rounding on, we can do this much more efficiently.
The func-release-rounding exhaustively tests all the queries we are
interested in.
This commit is contained in:
committed by
Matthew Parkinson
parent
486ef10c21
commit
8824622136
@@ -243,8 +243,11 @@ void test_external_pointer()
|
||||
void* p2 = pointer_offset(p1, offset);
|
||||
void* p3 = alloc->external_pointer(p2);
|
||||
void* p4 = alloc->external_pointer<End>(p2);
|
||||
UNUSED(p3);
|
||||
UNUSED(p4);
|
||||
if (p1 != p3)
|
||||
{
|
||||
std::cout << "size: " << size << " offset: " << offset << " p1: " << p1
|
||||
<< " p3: " << p3 << std::endl;
|
||||
}
|
||||
SNMALLOC_CHECK(p1 == p3);
|
||||
SNMALLOC_CHECK((size_t)p4 == (size_t)p1 + size - 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user