Made test easier to pass

Heap is very unstable with non-power-of-two block sizes
This commit is contained in:
2023-02-28 23:08:16 -06:00
parent 5d7a1bc316
commit eb15a7764e
2 changed files with 5 additions and 3 deletions

1
.gitignore vendored
View File

@@ -17,4 +17,5 @@ autom4te.cache
include/config.h* include/config.h*
missing missing
stamp-h1 stamp-h1
.deps
tests/test_bitmapalloc tests/test_bitmapalloc

View File

@@ -149,12 +149,13 @@ int main(int argc, char **args)
test_heap(256, 1, 128, 1); test_heap(256, 1, 128, 1);
test_heap(256, 1, 4, 1); test_heap(256, 1, 4, 1);
for(int bs = 1; bs <= 32; bs++) for(int bs = 1; bs <= 32; bs *= 2)
{ {
unsigned long heap_size = (1 << llog2(bs)) * 256;
unsigned long n = (8 * sizeof(unsigned long)) - 1 - __builtin_clzl((unsigned long) bs); unsigned long n = (8 * sizeof(unsigned long)) - 1 - __builtin_clzl((unsigned long) bs);
for(int bits = 1; bits <= (8 * sizeof(unsigned long)) && (2 * bits) < (8 * (1 << n)); bits <<= 1) for(int bits = 1; bits < (8 * sizeof(unsigned long)) && (2 * bits) < (8 * (1 << n)); bits <<= 1)
{ {
test_heap(1024, bs, bits, 0); test_heap(heap_size, bs, bits, 0);
} }
} }
} }