WIP
This commit is contained in:
parent
e9e6404115
commit
5bd3872153
1 changed files with 16 additions and 5 deletions
21
tests/soak.c
21
tests/soak.c
|
@ -128,7 +128,9 @@ _sparsemap_set(sparsemap_t **map, sparsemap_idx_t idx, bool value)
|
||||||
static void *
|
static void *
|
||||||
__sm_alloc(size_t capacity)
|
__sm_alloc(size_t capacity)
|
||||||
{
|
{
|
||||||
return (void *)sparsemap(capacity);
|
sparsemap_t *map = sparsemap(capacity);
|
||||||
|
assert(map != NULL);
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -271,6 +273,7 @@ static void *
|
||||||
__midl_alloc(size_t capacity)
|
__midl_alloc(size_t capacity)
|
||||||
{
|
{
|
||||||
MDB_IDL list = mdb_midl_alloc(capacity);
|
MDB_IDL list = mdb_midl_alloc(capacity);
|
||||||
|
assert(list != NULL);
|
||||||
return (void *)list;
|
return (void *)list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +290,7 @@ __midl_set(void **handle, pgno_t pg)
|
||||||
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
||||||
if (list[0] + 1 == list[-1]) {
|
if (list[0] + 1 == list[-1]) {
|
||||||
mdb_midl_need(_list, list[-1] + 1);
|
mdb_midl_need(_list, list[-1] + 1);
|
||||||
|
list = *_list;
|
||||||
}
|
}
|
||||||
mdb_midl_insert(list, pg);
|
mdb_midl_insert(list, pg);
|
||||||
return pg;
|
return pg;
|
||||||
|
@ -303,7 +307,7 @@ __midl_is_set(void *handle, pgno_t pg)
|
||||||
static pgno_t
|
static pgno_t
|
||||||
__midl_clear(void **handle, pgno_t pg)
|
__midl_clear(void **handle, pgno_t pg)
|
||||||
{
|
{
|
||||||
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
MDB_IDL list = (MDB_IDL *)*handle;
|
||||||
unsigned len = list[0];
|
unsigned len = list[0];
|
||||||
list[0] = len -= 1;
|
list[0] = len -= 1;
|
||||||
for (unsigned j = pg - 1; j < len;)
|
for (unsigned j = pg - 1; j < len;)
|
||||||
|
@ -344,7 +348,7 @@ search_done:;
|
||||||
static bool
|
static bool
|
||||||
__midl_take_span(void **handle, pgno_t pg, unsigned len)
|
__midl_take_span(void **handle, pgno_t pg, unsigned len)
|
||||||
{
|
{
|
||||||
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
MDB_IDL list = (MDB_IDL *)*handle;
|
||||||
int i = list[list[0]] == pg ? list[0] : mdb_midl_search(list, pg) + len;
|
int i = list[list[0]] == pg ? list[0] : mdb_midl_search(list, pg) + len;
|
||||||
unsigned j, num = len;
|
unsigned j, num = len;
|
||||||
pgno_t *mop = list;
|
pgno_t *mop = list;
|
||||||
|
@ -366,6 +370,7 @@ __midl_release_span(void **handle, pgno_t pg, unsigned len)
|
||||||
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
||||||
if (list[0] + len >= list[-1]) {
|
if (list[0] + len >= list[-1]) {
|
||||||
mdb_midl_need(_list, list[-1] + len);
|
mdb_midl_need(_list, list[-1] + len);
|
||||||
|
list = *_list;
|
||||||
}
|
}
|
||||||
for (size_t i = pg; i < pg + len; i++) {
|
for (size_t i = pg; i < pg + len; i++) {
|
||||||
mdb_midl_insert(list, i);
|
mdb_midl_insert(list, i);
|
||||||
|
@ -407,7 +412,12 @@ __midl_merge(void **handle, void *other_handle)
|
||||||
{
|
{
|
||||||
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
MDB_IDL *_list = (MDB_IDL *)handle, list = *_list;
|
||||||
MDB_IDL other = (MDB_IDL)other_handle;
|
MDB_IDL other = (MDB_IDL)other_handle;
|
||||||
|
if (list[0] + other[0] >= list[-1]) {
|
||||||
|
mdb_midl_need(_list, list[-1] + other[0]);
|
||||||
|
list = *_list;
|
||||||
|
}
|
||||||
mdb_midl_append_list(_list, other);
|
mdb_midl_append_list(_list, other);
|
||||||
|
list = *_list;
|
||||||
mdb_midl_sort(list);
|
mdb_midl_sort(list);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +454,9 @@ __midl_validate(void *handle)
|
||||||
static void *
|
static void *
|
||||||
__roar_alloc(size_t capacity)
|
__roar_alloc(size_t capacity)
|
||||||
{
|
{
|
||||||
return roaring_bitmap_create();
|
roaring_bitmap_t *map = roaring_bitmap_create();
|
||||||
|
assert(map != NULL);
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -497,7 +509,6 @@ __roar_take_span(void **handle, pgno_t pg, unsigned len)
|
||||||
{
|
{
|
||||||
roaring_bitmap_t **_rbm = (roaring_bitmap_t **)handle, *rbm = *_rbm;
|
roaring_bitmap_t **_rbm = (roaring_bitmap_t **)handle, *rbm = *_rbm;
|
||||||
roaring_bitmap_remove_range(rbm, pg, pg + len);
|
roaring_bitmap_remove_range(rbm, pg, pg + len);
|
||||||
roaring_bitmap_run_optimize(rbm);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue