Renamed lfsr_btree_update -> lfsr_btree_set
This commit is contained in:
@@ -4153,7 +4153,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_set(lfs_t *lfs, lfsr_btree_t *btree,
|
||||||
lfs_size_t bid, lfsr_tag_t tag, lfs_size_t weight, lfsr_data_t data) {
|
lfs_size_t bid, lfsr_tag_t tag, lfs_size_t weight, lfsr_data_t data) {
|
||||||
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);
|
||||||
@@ -5119,7 +5119,7 @@ static int lfsr_mtree_split_(lfs_t *lfs, lfsr_btree_t *mtree,
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = lfsr_btree_update(lfs, mtree, mid, LFSR_TAG_MDIR, 1,
|
err = lfsr_btree_set(lfs, mtree, mid, LFSR_TAG_MDIR, 1,
|
||||||
LFSR_DATA_BUF(buf, d));
|
LFSR_DATA_BUF(buf, d));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
@@ -5137,7 +5137,7 @@ static int lfsr_mtree_split_(lfs_t *lfs, lfsr_btree_t *mtree,
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = lfsr_btree_update(lfs, mtree, mid, LFSR_TAG_MDIR, 1,
|
err = lfsr_btree_set(lfs, mtree, mid, LFSR_TAG_MDIR, 1,
|
||||||
LFSR_DATA_BUF(buf, d));
|
LFSR_DATA_BUF(buf, d));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
@@ -5160,8 +5160,7 @@ static int lfsr_mtree_split_(lfs_t *lfs, lfsr_btree_t *mtree,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO static
|
static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir, lfs_ssize_t *rid,
|
||||||
int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir, lfs_ssize_t *rid,
|
|
||||||
const lfsr_attr_t *attrs, lfs_size_t attr_count) {
|
const lfsr_attr_t *attrs, lfs_size_t attr_count) {
|
||||||
LFS_ASSERT(mdir->mid != LFSR_MID_RM);
|
LFS_ASSERT(mdir->mid != LFSR_MID_RM);
|
||||||
|
|
||||||
@@ -5325,7 +5324,7 @@ int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir, lfs_ssize_t *rid,
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = lfsr_btree_update(lfs, &mtree_, mdir->mid, LFSR_TAG_MDIR, 1,
|
err = lfsr_btree_set(lfs, &mtree_, mdir->mid, LFSR_TAG_MDIR, 1,
|
||||||
LFSR_DATA_BUF(buf, d));
|
LFSR_DATA_BUF(buf, d));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
+14
-14
@@ -719,7 +719,7 @@ code = '''
|
|||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("a", 1)) => 0;
|
LFSR_DATA_BUF("a", 1)) => 0;
|
||||||
// update the tree
|
// update the tree
|
||||||
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_set(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("A", 1)) => 0;
|
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,
|
||||||
@@ -762,9 +762,9 @@ code = '''
|
|||||||
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("b", 1)) => 0;
|
LFSR_DATA_BUF("b", 1)) => 0;
|
||||||
// update the tree
|
// update the tree
|
||||||
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_set(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("A", 1)) => 0;
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
lfsr_btree_update(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
lfsr_btree_set(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("B", 1)) => 0;
|
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,
|
||||||
@@ -815,11 +815,11 @@ code = '''
|
|||||||
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("c", 1)) => 0;
|
LFSR_DATA_BUF("c", 1)) => 0;
|
||||||
// update the tree
|
// update the tree
|
||||||
lfsr_btree_update(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_set(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("A", 1)) => 0;
|
LFSR_DATA_BUF("A", 1)) => 0;
|
||||||
lfsr_btree_update(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
lfsr_btree_set(&lfs, &btree, 1, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("B", 1)) => 0;
|
LFSR_DATA_BUF("B", 1)) => 0;
|
||||||
lfsr_btree_update(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
lfsr_btree_set(&lfs, &btree, 2, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("C", 1)) => 0;
|
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,
|
||||||
@@ -887,7 +887,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_set(&lfs, &btree, i, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF(&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) {
|
||||||
@@ -982,7 +982,7 @@ code = '''
|
|||||||
lfs_size_t id = TEST_PRNG(&prng) % N;
|
lfs_size_t id = TEST_PRNG(&prng) % N;
|
||||||
|
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree, id, LFSR_TAG_INLINED, 1,
|
int err = lfsr_btree_set(&lfs, &btree, id, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF(&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) {
|
||||||
@@ -1065,7 +1065,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_set(&lfs, &btree, i*W+W-1, LFSR_TAG_INLINED, W,
|
||||||
LFSR_DATA_BUF(&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) {
|
||||||
@@ -1187,7 +1187,7 @@ code = '''
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree,
|
int err = lfsr_btree_set(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
||||||
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
LFSR_DATA_BUF(&uppers[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -2575,7 +2575,7 @@ code = '''
|
|||||||
|
|
||||||
} else if (op == 1) {
|
} else if (op == 1) {
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree, id,
|
int err = lfsr_btree_set(&lfs, &btree, id,
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -2716,7 +2716,7 @@ code = '''
|
|||||||
|
|
||||||
} else if (op == 1) {
|
} else if (op == 1) {
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree,
|
int err = lfsr_btree_set(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
||||||
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
LFSR_DATA_BUF(&alphas[i % 26], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -3623,7 +3623,7 @@ code = '''
|
|||||||
|
|
||||||
} else if (op == 1) {
|
} else if (op == 1) {
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree, id,
|
int err = lfsr_btree_set(&lfs, &btree, id,
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF(&nums[i % 10], 1));
|
LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -3830,7 +3830,7 @@ code = '''
|
|||||||
|
|
||||||
} else if (op == 1) {
|
} else if (op == 1) {
|
||||||
// update btree
|
// update btree
|
||||||
int err = lfsr_btree_update(&lfs, &btree,
|
int err = lfsr_btree_set(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
weighted_id+sim_weights[id]-1, LFSR_TAG_INLINED, weight,
|
||||||
LFSR_DATA_BUF(&nums[i % 10], 1));
|
LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
|
|||||||
Reference in New Issue
Block a user