Adopted lfsr_data_t in btree push/update/split functions
This is mostly for consistency. It's unclear if we'll ever actually use the on-disk lfsr_data_t representation here, since current thoughts expect most btrees to only store pointers with in-device representations. It may be worth reverting this in the future.
This commit is contained in:
@@ -4020,8 +4020,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
||||||
lfs_size_t bid, lfsr_tag_t tag, lfs_size_t weight,
|
lfs_size_t bid, lfsr_tag_t tag, lfs_size_t weight, lfsr_data_t data) {
|
||||||
const void *buffer, lfs_size_t size) {
|
|
||||||
LFS_ASSERT(bid <= lfsr_btree_weight(btree));
|
LFS_ASSERT(bid <= lfsr_btree_weight(btree));
|
||||||
|
|
||||||
// null btree?
|
// null btree?
|
||||||
@@ -4031,9 +4030,13 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
btree->weight = lfsr_btree_setinlined(weight);
|
btree->weight = lfsr_btree_setinlined(weight);
|
||||||
btree->inlined.tag = tag;
|
btree->inlined.tag = tag;
|
||||||
|
|
||||||
LFS_ASSERT(size <= LFSR_BTREE_INLINESIZE);
|
lfs_ssize_t d = lfsr_data_read(lfs, data, 0,
|
||||||
memcpy(btree->inlined.buffer, buffer, size);
|
btree->inlined.buffer, LFSR_BTREE_INLINESIZE);
|
||||||
btree->inlined.size = size;
|
if (d < 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
LFS_ASSERT(d <= LFSR_BTREE_INLINESIZE);
|
||||||
|
btree->inlined.size = d;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// inlined btree, need to expand into an rbyd
|
// inlined btree, need to expand into an rbyd
|
||||||
@@ -4050,9 +4053,8 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
0, lfsr_tag_setmk(btree->inlined.tag),
|
0, lfsr_tag_setmk(btree->inlined.tag),
|
||||||
+lfsr_btree_weight(btree),
|
+lfsr_btree_weight(btree),
|
||||||
btree->inlined.buffer, btree->inlined.size),
|
btree->inlined.buffer, btree->inlined.size),
|
||||||
LFSR_ATTR_(
|
LFSR_ATTR_DATA_(
|
||||||
bid, lfsr_tag_setmk(tag), +weight,
|
bid, lfsr_tag_setmk(tag), +weight, data)));
|
||||||
buffer, size)));
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -4093,8 +4095,7 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
// of the rest
|
// of the rest
|
||||||
int degenerate = lfsr_btree_commit(lfs, btree, bid_, 0, &rbyd,
|
int degenerate = lfsr_btree_commit(lfs, btree, bid_, 0, &rbyd,
|
||||||
LFSR_BTREE_ATTRS(
|
LFSR_BTREE_ATTRS(
|
||||||
LFSR_ATTR_(rid, lfsr_tag_setmk(tag), +weight,
|
LFSR_ATTR_DATA_(rid, lfsr_tag_setmk(tag), +weight, data)));
|
||||||
buffer, size)));
|
|
||||||
if (degenerate < 0) {
|
if (degenerate < 0) {
|
||||||
return degenerate;
|
return degenerate;
|
||||||
}
|
}
|
||||||
@@ -4104,9 +4105,13 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
btree->weight = lfsr_btree_setinlined(weight);
|
btree->weight = lfsr_btree_setinlined(weight);
|
||||||
btree->inlined.tag = tag;
|
btree->inlined.tag = tag;
|
||||||
|
|
||||||
LFS_ASSERT(size <= LFSR_BTREE_INLINESIZE);
|
lfs_ssize_t d = lfsr_data_read(lfs, data, 0,
|
||||||
memcpy(btree->inlined.buffer, buffer, size);
|
btree->inlined.buffer, LFSR_BTREE_INLINESIZE);
|
||||||
btree->inlined.size = size;
|
if (d < 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
LFS_ASSERT(d <= LFSR_BTREE_INLINESIZE);
|
||||||
|
btree->inlined.size = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4114,8 +4119,7 @@ static int lfsr_btree_push(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int lfsr_btree_update(lfs_t *lfs, lfsr_btree_t *btree,
|
static int lfsr_btree_update(lfs_t *lfs, lfsr_btree_t *btree,
|
||||||
lfs_size_t bid, lfsr_tag_t tag, lfs_size_t weight,
|
lfs_size_t bid, lfsr_tag_t tag, lfs_size_t weight, lfsr_data_t data) {
|
||||||
const void *buffer, lfs_size_t size) {
|
|
||||||
LFS_ASSERT(bid < lfsr_btree_weight(btree));
|
LFS_ASSERT(bid < lfsr_btree_weight(btree));
|
||||||
LFS_ASSERT(lfsr_btree_weight(btree) > 0);
|
LFS_ASSERT(lfsr_btree_weight(btree) > 0);
|
||||||
|
|
||||||
@@ -4126,9 +4130,13 @@ static int lfsr_btree_update(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
btree->weight = lfsr_btree_setinlined(weight);
|
btree->weight = lfsr_btree_setinlined(weight);
|
||||||
btree->inlined.tag = tag;
|
btree->inlined.tag = tag;
|
||||||
|
|
||||||
LFS_ASSERT(size <= LFSR_BTREE_INLINESIZE);
|
lfs_ssize_t d = lfsr_data_read(lfs, data, 0,
|
||||||
memcpy(btree->inlined.buffer, buffer, size);
|
btree->inlined.buffer, LFSR_BTREE_INLINESIZE);
|
||||||
btree->inlined.size = size;
|
if (d < 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
LFS_ASSERT(d <= LFSR_BTREE_INLINESIZE);
|
||||||
|
btree->inlined.size = d;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// a normal btree
|
// a normal btree
|
||||||
@@ -4152,7 +4160,7 @@ static int lfsr_btree_update(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
(tag != rtag
|
(tag != rtag
|
||||||
? LFSR_ATTR_(rid, lfsr_tag_setrm(rtag), 0, NULL, 0)
|
? LFSR_ATTR_(rid, lfsr_tag_setrm(rtag), 0, NULL, 0)
|
||||||
: LFSR_ATTR_NOOP),
|
: LFSR_ATTR_NOOP),
|
||||||
LFSR_ATTR_(rid, tag, 0, buffer, size),
|
LFSR_ATTR_DATA_(rid, tag, 0, data),
|
||||||
LFSR_ATTR(rid, UNR, +weight-rweight, NULL, 0)));
|
LFSR_ATTR(rid, UNR, +weight-rweight, NULL, 0)));
|
||||||
if (degenerate < 0) {
|
if (degenerate < 0) {
|
||||||
return degenerate;
|
return degenerate;
|
||||||
@@ -4163,9 +4171,13 @@ static int lfsr_btree_update(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
btree->weight = lfsr_btree_setinlined(weight);
|
btree->weight = lfsr_btree_setinlined(weight);
|
||||||
btree->inlined.tag = tag;
|
btree->inlined.tag = tag;
|
||||||
|
|
||||||
LFS_ASSERT(size <= LFSR_BTREE_INLINESIZE);
|
lfs_ssize_t d = lfsr_data_read(lfs, data, 0,
|
||||||
memcpy(btree->inlined.buffer, buffer, size);
|
btree->inlined.buffer, LFSR_BTREE_INLINESIZE);
|
||||||
btree->inlined.size = size;
|
if (d < 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
LFS_ASSERT(d <= LFSR_BTREE_INLINESIZE);
|
||||||
|
btree->inlined.size = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4268,10 +4280,8 @@ static int lfsr_btree_pop(lfs_t *lfs, lfsr_btree_t *btree, lfs_size_t bid) {
|
|||||||
//
|
//
|
||||||
static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
|
static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
|
||||||
lfs_size_t bid, lfsr_data_t name,
|
lfs_size_t bid, lfsr_data_t name,
|
||||||
lfsr_tag_t tag1, lfs_size_t weight1,
|
lfsr_tag_t tag1, lfs_size_t weight1, lfsr_data_t data1,
|
||||||
const void *buffer1, lfs_size_t size1,
|
lfsr_tag_t tag2, lfs_size_t weight2, lfsr_data_t data2) {
|
||||||
lfsr_tag_t tag2, lfs_size_t weight2,
|
|
||||||
const void *buffer2, lfs_size_t size2) {
|
|
||||||
LFS_ASSERT(bid < lfsr_btree_weight(btree));
|
LFS_ASSERT(bid < lfsr_btree_weight(btree));
|
||||||
LFS_ASSERT(lfsr_btree_weight(btree) > 0);
|
LFS_ASSERT(lfsr_btree_weight(btree) > 0);
|
||||||
|
|
||||||
@@ -4285,17 +4295,15 @@ static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
|
|
||||||
// commit our entries
|
// commit our entries
|
||||||
err = lfsr_rbyd_commit(lfs, &rbyd, LFSR_ATTRS(
|
err = lfsr_rbyd_commit(lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR_(0, lfsr_tag_setmk(tag1), +weight1,
|
LFSR_ATTR_DATA_(0, lfsr_tag_setmk(tag1), +weight1, data1),
|
||||||
buffer1, size1),
|
|
||||||
(lfsr_data_size(name) > 0
|
(lfsr_data_size(name) > 0
|
||||||
? LFSR_ATTR_DATA(weight1, MKBRANCH, +weight2,
|
? LFSR_ATTR_DATA(weight1, MKBRANCH, +weight2, name)
|
||||||
name)
|
|
||||||
: LFSR_ATTR_NOOP),
|
: LFSR_ATTR_NOOP),
|
||||||
(lfsr_data_size(name) > 0
|
(lfsr_data_size(name) > 0
|
||||||
? LFSR_ATTR_(weight1+weight2-1, tag2, 0,
|
? LFSR_ATTR_DATA_(weight1+weight2-1,
|
||||||
buffer2, size2)
|
tag2, 0, data2)
|
||||||
: LFSR_ATTR_(weight1, lfsr_tag_setmk(tag2), +weight2,
|
: LFSR_ATTR_DATA_(weight1,
|
||||||
buffer2, size2))));
|
lfsr_tag_setmk(tag2), +weight2, data2))));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -4321,19 +4329,17 @@ static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
int degenerate = lfsr_btree_commit(lfs, btree, bid, -1, &rbyd,
|
int degenerate = lfsr_btree_commit(lfs, btree, bid, -1, &rbyd,
|
||||||
LFSR_BTREE_ATTRS(
|
LFSR_BTREE_ATTRS(
|
||||||
LFSR_ATTR(rid, UNR, +weight1-rweight, NULL, 0),
|
LFSR_ATTR(rid, UNR, +weight1-rweight, NULL, 0),
|
||||||
LFSR_ATTR_(rid-(rweight-1)+weight1-1, tag1, 0,
|
LFSR_ATTR_DATA_(rid-(rweight-1)+weight1-1, tag1, 0, data1),
|
||||||
buffer1, size1),
|
|
||||||
(lfsr_data_size(name) > 0
|
(lfsr_data_size(name) > 0
|
||||||
? LFSR_ATTR_DATA(
|
? LFSR_ATTR_DATA(
|
||||||
rid-(rweight-1)+weight1, MKBRANCH, +weight2,
|
rid-(rweight-1)+weight1, MKBRANCH, +weight2,
|
||||||
name)
|
name)
|
||||||
: LFSR_ATTR_NOOP),
|
: LFSR_ATTR_NOOP),
|
||||||
(lfsr_data_size(name) > 0
|
(lfsr_data_size(name) > 0
|
||||||
? LFSR_ATTR_(rid-(rweight-1)+weight1+weight2-1, tag2, 0,
|
? LFSR_ATTR_DATA_(rid-(rweight-1)+weight1+weight2-1,
|
||||||
buffer2, size2)
|
tag2, 0, data2)
|
||||||
: LFSR_ATTR_(rid-(rweight-1)+weight1,
|
: LFSR_ATTR_DATA_(rid-(rweight-1)+weight1,
|
||||||
lfsr_tag_setmk(tag2), +weight2,
|
lfsr_tag_setmk(tag2), +weight2, data2))));
|
||||||
buffer2, size2))));
|
|
||||||
if (degenerate < 0) {
|
if (degenerate < 0) {
|
||||||
return degenerate;
|
return degenerate;
|
||||||
}
|
}
|
||||||
@@ -4812,7 +4818,7 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir, lfs_ssize_t *rid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = lfsr_btree_push(lfs, &lfs->mtree, 0, LFSR_TAG_MDIR, 1,
|
err = lfsr_btree_push(lfs, &lfs->mtree, 0, LFSR_TAG_MDIR, 1,
|
||||||
buf, d);
|
LFSR_DATA_BUF(buf, d));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -5009,7 +5015,7 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir, lfs_ssize_t *rid,
|
|||||||
// TODO do we really need an explicit push when creating a new,
|
// TODO do we really need an explicit push when creating a new,
|
||||||
// 2-sized btree?
|
// 2-sized btree?
|
||||||
err = lfsr_btree_push(lfs, &lfs->mtree, 0, LFSR_TAG_MDIR, 1,
|
err = lfsr_btree_push(lfs, &lfs->mtree, 0, LFSR_TAG_MDIR, 1,
|
||||||
NULL, 0);
|
LFSR_DATA_NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -5032,8 +5038,8 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir, lfs_ssize_t *rid,
|
|||||||
(lfsr_tag_suptype(stag) == LFSR_TAG_NAME
|
(lfsr_tag_suptype(stag) == LFSR_TAG_NAME
|
||||||
? sdata
|
? sdata
|
||||||
: LFSR_DATA_NULL),
|
: LFSR_DATA_NULL),
|
||||||
LFSR_TAG_MDIR, 1, buf1, d1,
|
LFSR_TAG_MDIR, 1, LFSR_DATA_BUF(buf1, d1),
|
||||||
LFSR_TAG_MDIR, 1, buf2, d2);
|
LFSR_TAG_MDIR, 1, LFSR_DATA_BUF(buf2, d2));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
+159
-110
@@ -54,7 +54,8 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -95,8 +96,10 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -143,8 +146,10 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -192,9 +197,12 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1, "c", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("c", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -248,9 +256,12 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "c", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("c", 1)) => 0;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -311,7 +322,7 @@ code = '''
|
|||||||
lfs_size_t n = 0;
|
lfs_size_t n = 0;
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -366,7 +377,7 @@ code = '''
|
|||||||
lfs_size_t n = 0;
|
lfs_size_t n = 0;
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[(N-1-i) % 26], 1);
|
LFSR_DATA_BUF(&alphas[(N-1-i) % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -446,7 +457,7 @@ code = '''
|
|||||||
|
|
||||||
// add to btree
|
// add to btree
|
||||||
int err = lfsr_btree_push(&lfs, &btree, id, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, id, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -521,7 +532,7 @@ code = '''
|
|||||||
lfs_size_t n = 0;
|
lfs_size_t n = 0;
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -631,7 +642,7 @@ code = '''
|
|||||||
// add to btree
|
// add to btree
|
||||||
int err = lfsr_btree_push(&lfs, &btree,
|
int err = lfsr_btree_push(&lfs, &btree,
|
||||||
weighted_id, LFSR_TAG_INLINED, weight,
|
weighted_id, LFSR_TAG_INLINED, weight,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -748,9 +759,11 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
// update the tree
|
// update the tree
|
||||||
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "A", 1) => 0;
|
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -790,11 +803,15 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
// update the tree
|
// update the tree
|
||||||
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "A", 1) => 0;
|
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_update(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "B", 1) => 0;
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
|
lfsr_btree_update(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("B", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -841,13 +858,19 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1, "c", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("c", 1)) => 0;
|
||||||
// update the tree
|
// update the tree
|
||||||
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "A", 1) => 0;
|
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_update(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "B", 1) => 0;
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
lfsr_btree_update(&lfs, &btree, 2, LFSR_TAG_INLINED, 1, "C", 1) => 0;
|
lfsr_btree_update(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("B", 1)) => 0;
|
||||||
|
lfsr_btree_update(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("C", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -906,7 +929,7 @@ code = '''
|
|||||||
const char *uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const char *uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -920,7 +943,7 @@ code = '''
|
|||||||
// update the tree
|
// update the tree
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_update(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_update(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&uppers[i % 26], 1);
|
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -990,7 +1013,7 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1018,7 +1041,7 @@ code = '''
|
|||||||
|
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree, id, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_update(&lfs, &btree, id, LFSR_TAG_INLINED, 1,
|
||||||
&uppers[i % 26], 1);
|
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -1090,7 +1113,7 @@ code = '''
|
|||||||
const char *uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const char *uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1104,7 +1127,7 @@ code = '''
|
|||||||
// update the tree
|
// update the tree
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_update(&lfs, &btree, i*W+W-1, LFSR_TAG_INLINED, W,
|
int err = lfsr_btree_update(&lfs, &btree, i*W+W-1, LFSR_TAG_INLINED, W,
|
||||||
&uppers[i % 26], 1);
|
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1193,7 +1216,7 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1232,7 +1255,7 @@ code = '''
|
|||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree,
|
int err = lfsr_btree_update(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
||||||
&uppers[i % 26], 1);
|
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -1346,7 +1369,8 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
// pop!
|
// pop!
|
||||||
lfsr_btree_pop(&lfs, &btree, 0) => 0;
|
lfsr_btree_pop(&lfs, &btree, 0) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1365,7 +1389,8 @@ code = '''
|
|||||||
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
||||||
|
|
||||||
// try to putting it back to see if things still work
|
// try to putting it back to see if things still work
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "A", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -1401,8 +1426,10 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
// pop!
|
// pop!
|
||||||
lfsr_btree_pop(&lfs, &btree, 1) => 0;
|
lfsr_btree_pop(&lfs, &btree, 1) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1428,7 +1455,8 @@ code = '''
|
|||||||
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
||||||
|
|
||||||
// try to putting it back to see if things still work
|
// try to putting it back to see if things still work
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "B", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("B", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -1471,8 +1499,10 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
// pop!
|
// pop!
|
||||||
lfsr_btree_pop(&lfs, &btree, 0) => 0;
|
lfsr_btree_pop(&lfs, &btree, 0) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1498,7 +1528,8 @@ code = '''
|
|||||||
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
||||||
|
|
||||||
// try to putting it back to see if things still work
|
// try to putting it back to see if things still work
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "A", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -1541,9 +1572,12 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "a", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1, "b", 1) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1, "c", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
|
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("c", 1)) => 0;
|
||||||
// pop!
|
// pop!
|
||||||
lfsr_btree_pop(&lfs, &btree, 2) => 0;
|
lfsr_btree_pop(&lfs, &btree, 2) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1576,7 +1610,8 @@ code = '''
|
|||||||
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
buffer, 4, VALIDATE) => LFS_ERR_NOENT;
|
||||||
|
|
||||||
// try to putting it back to see if things still work
|
// try to putting it back to see if things still work
|
||||||
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1, "C", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("C", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -1632,7 +1667,7 @@ code = '''
|
|||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1684,7 +1719,7 @@ code = '''
|
|||||||
|
|
||||||
// try recovering
|
// try recovering
|
||||||
lfsr_btree_push(&lfs, &btree, REMAINING, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, REMAINING, LFSR_TAG_INLINED, 1,
|
||||||
"R", 1) => 0;
|
LFSR_DATA_BUF("R", 1)) => 0;
|
||||||
|
|
||||||
for (lfs_size_t i = 0; i < REMAINING; i++) {
|
for (lfs_size_t i = 0; i < REMAINING; i++) {
|
||||||
lfsr_btree_get(&lfs, &btree, i,
|
lfsr_btree_get(&lfs, &btree, i,
|
||||||
@@ -1729,7 +1764,7 @@ code = '''
|
|||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1780,7 +1815,7 @@ code = '''
|
|||||||
|
|
||||||
// try recovering
|
// try recovering
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
"R", 1) => 0;
|
LFSR_DATA_BUF("R", 1)) => 0;
|
||||||
|
|
||||||
lfsr_btree_get(&lfs, &btree, 0,
|
lfsr_btree_get(&lfs, &btree, 0,
|
||||||
&tag_, &weight_,
|
&tag_, &weight_,
|
||||||
@@ -1837,7 +1872,7 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_push(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1939,7 +1974,7 @@ code = '''
|
|||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
for (lfs_size_t i = 0; i < N; i++) {
|
for (lfs_size_t i = 0; i < N; i++) {
|
||||||
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
int err = lfsr_btree_push(&lfs, &btree, i*W, LFSR_TAG_INLINED, W,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -1990,7 +2025,7 @@ code = '''
|
|||||||
|
|
||||||
// try recovering
|
// try recovering
|
||||||
lfsr_btree_push(&lfs, &btree, REMAINING*W, LFSR_TAG_INLINED, W,
|
lfsr_btree_push(&lfs, &btree, REMAINING*W, LFSR_TAG_INLINED, W,
|
||||||
"R", 1) => 0;
|
LFSR_DATA_BUF("R", 1)) => 0;
|
||||||
|
|
||||||
for (lfs_size_t i = 0; i < REMAINING; i++) {
|
for (lfs_size_t i = 0; i < REMAINING; i++) {
|
||||||
lfsr_btree_get(&lfs, &btree, i*W+W-1,
|
lfsr_btree_get(&lfs, &btree, i*W+W-1,
|
||||||
@@ -2098,7 +2133,7 @@ code = '''
|
|||||||
|
|
||||||
int err = lfsr_btree_push(&lfs, &btree,
|
int err = lfsr_btree_push(&lfs, &btree,
|
||||||
weighted_id, LFSR_TAG_INLINED, weight,
|
weighted_id, LFSR_TAG_INLINED, weight,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -2242,12 +2277,12 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
&alphas[0 % 26], 1) => 0;
|
LFSR_DATA_BUF(&alphas[0 % 26], 1)) => 0;
|
||||||
lfs_size_t n = 1;
|
lfs_size_t n = 1;
|
||||||
for (lfs_size_t i = 1; i < N; i++) {
|
for (lfs_size_t i = 1; i < N; i++) {
|
||||||
int err = lfsr_btree_split(&lfs, &btree, i-1, LFSR_DATA_NULL,
|
int err = lfsr_btree_split(&lfs, &btree, i-1, LFSR_DATA_NULL,
|
||||||
LFSR_TAG_INLINED, 1, &alphas[(i-1) % 26], 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&alphas[(i-1) % 26], 1),
|
||||||
LFSR_TAG_INLINED, 1, &alphas[(i-0) % 26], 1);
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&alphas[(i-0) % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2313,7 +2348,7 @@ code = '''
|
|||||||
// create a btree
|
// create a btree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
"_", 1) => 0;
|
LFSR_DATA_BUF("_", 1)) => 0;
|
||||||
|
|
||||||
// set up a simulation to compare against
|
// set up a simulation to compare against
|
||||||
//
|
//
|
||||||
@@ -2331,8 +2366,8 @@ code = '''
|
|||||||
|
|
||||||
// split btree
|
// split btree
|
||||||
int err = lfsr_btree_split(&lfs, &btree, id, LFSR_DATA_NULL,
|
int err = lfsr_btree_split(&lfs, &btree, id, LFSR_DATA_NULL,
|
||||||
LFSR_TAG_INLINED, 1, &alphas[i % 26], 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&alphas[i % 26], 1),
|
||||||
LFSR_TAG_INLINED, 1, &uppers[i % 26], 1);
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2406,12 +2441,12 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
||||||
&alphas[0 % 26], 1) => 0;
|
LFSR_DATA_BUF(&alphas[0 % 26], 1)) => 0;
|
||||||
lfs_size_t n = 1;
|
lfs_size_t n = 1;
|
||||||
for (lfs_size_t i = 1; i < N; i++) {
|
for (lfs_size_t i = 1; i < N; i++) {
|
||||||
int err = lfsr_btree_split(&lfs, &btree, (i-1)*W+W-1, LFSR_DATA_NULL,
|
int err = lfsr_btree_split(&lfs, &btree, (i-1)*W+W-1, LFSR_DATA_NULL,
|
||||||
LFSR_TAG_INLINED, W, &alphas[(i-1) % 26], 1,
|
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&alphas[(i-1) % 26], 1),
|
||||||
LFSR_TAG_INLINED, W, &alphas[(i-0) % 26], 1);
|
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&alphas[(i-0) % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2478,7 +2513,7 @@ code = '''
|
|||||||
// create a btree
|
// create a btree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
||||||
"_", 1) => 0;
|
LFSR_DATA_BUF("_", 1)) => 0;
|
||||||
|
|
||||||
// set up a simulation to compare against
|
// set up a simulation to compare against
|
||||||
//
|
//
|
||||||
@@ -2509,8 +2544,10 @@ code = '''
|
|||||||
// split btree
|
// split btree
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_DATA_NULL,
|
weighted_id+sim_weights[id]-1, LFSR_DATA_NULL,
|
||||||
LFSR_TAG_INLINED, weight1, &alphas[i % 26], 1,
|
LFSR_TAG_INLINED, weight1,
|
||||||
LFSR_TAG_INLINED, weight2, &uppers[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1),
|
||||||
|
LFSR_TAG_INLINED, weight2,
|
||||||
|
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2662,7 +2699,7 @@ code = '''
|
|||||||
// push to btree
|
// push to btree
|
||||||
int err = lfsr_btree_push(&lfs, &btree, id,
|
int err = lfsr_btree_push(&lfs, &btree, id,
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2678,7 +2715,7 @@ code = '''
|
|||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree, id,
|
int err = lfsr_btree_update(&lfs, &btree, id,
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2803,7 +2840,7 @@ code = '''
|
|||||||
// push to btree
|
// push to btree
|
||||||
int err = lfsr_btree_push(&lfs, &btree, weighted_id,
|
int err = lfsr_btree_push(&lfs, &btree, weighted_id,
|
||||||
LFSR_TAG_INLINED, weight,
|
LFSR_TAG_INLINED, weight,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2822,7 +2859,7 @@ code = '''
|
|||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree,
|
int err = lfsr_btree_update(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
||||||
&alphas[i % 26], 1);
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -2980,7 +3017,8 @@ code = '''
|
|||||||
|
|
||||||
// create a single-entry tree
|
// create a single-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -3026,10 +3064,11 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
||||||
LFSR_TAG_INLINED, 1, "0", 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
||||||
LFSR_TAG_INLINED, 1, "1", 1) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -3083,13 +3122,14 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
||||||
LFSR_TAG_INLINED, 1, "0", 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
||||||
LFSR_TAG_INLINED, 1, "1", 1) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 1, LFSR_DATA_BUF("aac", 3),
|
lfsr_btree_split(&lfs, &btree, 1, LFSR_DATA_BUF("aac", 3),
|
||||||
LFSR_TAG_INLINED, 1, "1", 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1),
|
||||||
LFSR_TAG_INLINED, 1, "2", 1) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("2", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -3151,13 +3191,14 @@ code = '''
|
|||||||
|
|
||||||
// create a two-entry tree
|
// create a two-entry tree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aac", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aac", 3),
|
||||||
LFSR_TAG_INLINED, 1, "1", 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1),
|
||||||
LFSR_TAG_INLINED, 1, "2", 1) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("2", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
||||||
LFSR_TAG_INLINED, 1, "0", 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
||||||
LFSR_TAG_INLINED, 1, "1", 1) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
btree.weight,
|
btree.weight,
|
||||||
btree.root.block,
|
btree.root.block,
|
||||||
@@ -3223,15 +3264,15 @@ code = '''
|
|||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
const char *nums = "0123456789";
|
const char *nums = "0123456789";
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
&nums[0 % 10], 1) => 0;
|
LFSR_DATA_BUF(&nums[0 % 10], 1)) => 0;
|
||||||
lfs_size_t n = 1;
|
lfs_size_t n = 1;
|
||||||
for (lfs_size_t i = 1; i < N; i++) {
|
for (lfs_size_t i = 1; i < N; i++) {
|
||||||
char name[3] = {
|
char name[3] = {
|
||||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||||
};
|
};
|
||||||
int err = lfsr_btree_split(&lfs, &btree, i-1, LFSR_DATA_BUF(name, 3),
|
int err = lfsr_btree_split(&lfs, &btree, i-1, LFSR_DATA_BUF(name, 3),
|
||||||
LFSR_TAG_INLINED, 1, &nums[(i-1) % 10], 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[(i-1) % 10], 1),
|
||||||
LFSR_TAG_INLINED, 1, &nums[(i-0) % 10], 1);
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[(i-0) % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3298,7 +3339,7 @@ code = '''
|
|||||||
// create a btree
|
// create a btree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
"_", 1) => 0;
|
LFSR_DATA_BUF("_", 1)) => 0;
|
||||||
|
|
||||||
// set up a simulation to compare against
|
// set up a simulation to compare against
|
||||||
//
|
//
|
||||||
@@ -3332,8 +3373,8 @@ code = '''
|
|||||||
|
|
||||||
// split btree
|
// split btree
|
||||||
int err = lfsr_btree_split(&lfs, &btree, id, LFSR_DATA_BUF(name, 3),
|
int err = lfsr_btree_split(&lfs, &btree, id, LFSR_DATA_BUF(name, 3),
|
||||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1,
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1);
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3408,7 +3449,7 @@ code = '''
|
|||||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||||
const char *nums = "0123456789";
|
const char *nums = "0123456789";
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
||||||
&nums[0 % 10], 1) => 0;
|
LFSR_DATA_BUF(&nums[0 % 10], 1)) => 0;
|
||||||
lfs_size_t n = 1;
|
lfs_size_t n = 1;
|
||||||
for (lfs_size_t i = 1; i < N; i++) {
|
for (lfs_size_t i = 1; i < N; i++) {
|
||||||
char name[3] = {
|
char name[3] = {
|
||||||
@@ -3416,8 +3457,8 @@ code = '''
|
|||||||
};
|
};
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
(i-1)*W+W-1, LFSR_DATA_BUF(name, 3),
|
(i-1)*W+W-1, LFSR_DATA_BUF(name, 3),
|
||||||
LFSR_TAG_INLINED, W, &nums[(i-1) % 10], 1,
|
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&nums[(i-1) % 10], 1),
|
||||||
LFSR_TAG_INLINED, W, &nums[(i-0) % 10], 1);
|
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&nums[(i-0) % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3485,7 +3526,7 @@ code = '''
|
|||||||
// create a btree
|
// create a btree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
||||||
"_", 1) => 0;
|
LFSR_DATA_BUF("_", 1)) => 0;
|
||||||
|
|
||||||
// set up a simulation to compare against
|
// set up a simulation to compare against
|
||||||
//
|
//
|
||||||
@@ -3532,8 +3573,8 @@ code = '''
|
|||||||
// split btree
|
// split btree
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_DATA_BUF(name, 3),
|
weighted_id+sim_weights[id]-1, LFSR_DATA_BUF(name, 3),
|
||||||
LFSR_TAG_INLINED, weight1, &nums[i % 10], 1,
|
LFSR_TAG_INLINED, weight1, LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
LFSR_TAG_INLINED, weight2, &nums[i % 10], 1);
|
LFSR_TAG_INLINED, weight2, LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3646,7 +3687,7 @@ code = '''
|
|||||||
// create a btree
|
// create a btree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
"_", 1) => 0;
|
LFSR_DATA_BUF("_", 1)) => 0;
|
||||||
|
|
||||||
// set up a simulation to compare against
|
// set up a simulation to compare against
|
||||||
//
|
//
|
||||||
@@ -3695,8 +3736,10 @@ code = '''
|
|||||||
if (split_id > id) {
|
if (split_id > id) {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_BUF(sim_names[id+1], 3),
|
split_id, LFSR_DATA_BUF(sim_names[id+1], 3),
|
||||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
LFSR_TAG_INLINED, 1, split_buf, 1);
|
LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
|
LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF(split_buf, 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3705,8 +3748,10 @@ code = '''
|
|||||||
} else {
|
} else {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_BUF(name, 3),
|
split_id, LFSR_DATA_BUF(name, 3),
|
||||||
LFSR_TAG_INLINED, 1, split_buf, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1);
|
LFSR_DATA_BUF(split_buf, 1),
|
||||||
|
LFSR_TAG_INLINED, 1,
|
||||||
|
LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3725,7 +3770,7 @@ code = '''
|
|||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree, id,
|
int err = lfsr_btree_update(&lfs, &btree, id,
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
&nums[i % 10], 1);
|
LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3827,7 +3872,7 @@ code = '''
|
|||||||
// create a btree
|
// create a btree
|
||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, W,
|
||||||
"_", 1) => 0;
|
LFSR_DATA_BUF("_", 1)) => 0;
|
||||||
|
|
||||||
// set up a simulation to compare against
|
// set up a simulation to compare against
|
||||||
//
|
//
|
||||||
@@ -3895,8 +3940,10 @@ code = '''
|
|||||||
if (split_id > weighted_id+sim_weights[id]-1) {
|
if (split_id > weighted_id+sim_weights[id]-1) {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_BUF(sim_names[id+1], 3),
|
split_id, LFSR_DATA_BUF(sim_names[id+1], 3),
|
||||||
LFSR_TAG_INLINED, weight, &nums[i % 10], 1,
|
LFSR_TAG_INLINED, weight,
|
||||||
LFSR_TAG_INLINED, split_weight, split_buf, 1);
|
LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
|
LFSR_TAG_INLINED, split_weight,
|
||||||
|
LFSR_DATA_BUF(split_buf, 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3905,8 +3952,10 @@ code = '''
|
|||||||
} else {
|
} else {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_BUF(name, 3),
|
split_id, LFSR_DATA_BUF(name, 3),
|
||||||
LFSR_TAG_INLINED, split_weight, split_buf, 1,
|
LFSR_TAG_INLINED, split_weight,
|
||||||
LFSR_TAG_INLINED, weight, &nums[i % 10], 1);
|
LFSR_DATA_BUF(split_buf, 1),
|
||||||
|
LFSR_TAG_INLINED, weight,
|
||||||
|
LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
@@ -3928,7 +3977,7 @@ code = '''
|
|||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree,
|
int err = lfsr_btree_update(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
||||||
&nums[i % 10], 1);
|
LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
if (err == LFS_ERR_NOSPC) {
|
if (err == LFS_ERR_NOSPC) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user