Reserved bit 7 for leb128 subtypes in the future
This should have also been done previouly as a part of the tag reencoding work. Oh well.
This commit is contained in:
@@ -642,26 +642,26 @@ enum lfsr_tag_type {
|
|||||||
|
|
||||||
#define LFSR_TAG_UATTR(attr) \
|
#define LFSR_TAG_UATTR(attr) \
|
||||||
(LFSR_TAG_UATTR \
|
(LFSR_TAG_UATTR \
|
||||||
| (0xff & (lfsr_tag_t)(attr)))
|
| (0x7f & (lfsr_tag_t)(attr)))
|
||||||
|
|
||||||
// TODO test only?
|
// TODO test only?
|
||||||
#define LFSR_TAG_WIDEUATTR(attr) \
|
#define LFSR_TAG_WIDEUATTR(attr) \
|
||||||
(LFSR_TAG_WIDEUATTR \
|
(LFSR_TAG_WIDEUATTR \
|
||||||
| (0xff & (lfsr_tag_t)(attr)))
|
| (0x7f & (lfsr_tag_t)(attr)))
|
||||||
|
|
||||||
// TODO test only?
|
// TODO test only?
|
||||||
#define LFSR_TAG_GROWUATTR(attr) \
|
#define LFSR_TAG_GROWUATTR(attr) \
|
||||||
(LFSR_TAG_GROWUATTR \
|
(LFSR_TAG_GROWUATTR \
|
||||||
| (0xff & (lfsr_tag_t)(attr)))
|
| (0x7f & (lfsr_tag_t)(attr)))
|
||||||
|
|
||||||
#define LFSR_TAG_RMUATTR(attr) \
|
#define LFSR_TAG_RMUATTR(attr) \
|
||||||
(LFSR_TAG_RMUATTR \
|
(LFSR_TAG_RMUATTR \
|
||||||
| (0xff & (lfsr_tag_t)(attr)))
|
| (0x7f & (lfsr_tag_t)(attr)))
|
||||||
|
|
||||||
// TODO test only?
|
// TODO test only?
|
||||||
#define LFSR_TAG_SATTR(attr) \
|
#define LFSR_TAG_SATTR(attr) \
|
||||||
(LFSR_TAG_SATTR \
|
(LFSR_TAG_SATTR \
|
||||||
| (0xff & (lfsr_tag_t)(attr)))
|
| (0x7f & (lfsr_tag_t)(attr)))
|
||||||
|
|
||||||
// tag type operations
|
// tag type operations
|
||||||
static inline lfsr_tag_t lfsr_tag_mode(lfsr_tag_t tag) {
|
static inline lfsr_tag_t lfsr_tag_mode(lfsr_tag_t tag) {
|
||||||
@@ -1785,8 +1785,9 @@ static int lfsr_rbyd_lookupnext(lfs_t *lfs, const lfsr_rbyd_t *rbyd,
|
|||||||
lfs_ssize_t id, lfsr_tag_t tag,
|
lfs_ssize_t id, lfsr_tag_t tag,
|
||||||
lfs_ssize_t *id_, lfsr_tag_t *tag_, lfs_size_t *weight_,
|
lfs_ssize_t *id_, lfsr_tag_t *tag_, lfs_size_t *weight_,
|
||||||
lfsr_data_t *data_) {
|
lfsr_data_t *data_) {
|
||||||
// these bits should be clear at this point
|
// tag must be valid at this point
|
||||||
LFS_ASSERT(lfsr_tag_isvalid(tag));
|
LFS_ASSERT(lfsr_tag_isvalid(tag));
|
||||||
|
// these bits should be clear at this point
|
||||||
LFS_ASSERT(lfsr_tag_mode(tag) == 0x0000);
|
LFS_ASSERT(lfsr_tag_mode(tag) == 0x0000);
|
||||||
|
|
||||||
// make sure we never look up zero tags, the way we create
|
// make sure we never look up zero tags, the way we create
|
||||||
@@ -2011,9 +2012,12 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
|||||||
lfsr_data_t data) {
|
lfsr_data_t data) {
|
||||||
// must fetch before mutating!
|
// must fetch before mutating!
|
||||||
LFS_ASSERT(lfsr_rbyd_isfetched(rbyd));
|
LFS_ASSERT(lfsr_rbyd_isfetched(rbyd));
|
||||||
// never write zero tags to disk, use unr if tag contains no data
|
// tag must be valid at this point
|
||||||
LFS_ASSERT(lfsr_tag_isvalid(tag));
|
LFS_ASSERT(lfsr_tag_isvalid(tag));
|
||||||
|
// never write zero tags to disk, use unr if tag contains no data
|
||||||
LFS_ASSERT(tag != 0);
|
LFS_ASSERT(tag != 0);
|
||||||
|
// reserve bit 7 to allow leb128 subtypes in the future
|
||||||
|
LFS_ASSERT(!(tag & 0x80));
|
||||||
|
|
||||||
// we can't do anything if we're not erased
|
// we can't do anything if we're not erased
|
||||||
int err;
|
int err;
|
||||||
|
|||||||
+46
-46
@@ -2645,12 +2645,12 @@ code = '''
|
|||||||
lfs_size_t count = 0;
|
lfs_size_t count = 0;
|
||||||
uint32_t prng = 42;
|
uint32_t prng = 42;
|
||||||
for (lfs_size_t i = 0;; i++) {
|
for (lfs_size_t i = 0;; i++) {
|
||||||
uint8_t x
|
lfs_size_t x
|
||||||
= (ORDER == 0) ? (uint8_t)i
|
= (ORDER == 0) ? i
|
||||||
: (ORDER == 1) ? (uint8_t)(((lfs_size_t)-1) - i)
|
: (ORDER == 1) ? (((lfs_size_t)-1) - i)
|
||||||
: (uint8_t)TEST_PRNG(&prng);
|
: TEST_PRNG(&prng);
|
||||||
int err = lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
int err = lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(-1, UATTR(x), 0, "\xaa\xaa\xaa\xaa", 4)));
|
LFSR_ATTR(-1, UATTR(x & 0x7f), 0, "\xaa\xaa\xaa\xaa", 4)));
|
||||||
if (err == LFS_ERR_RANGE) {
|
if (err == LFS_ERR_RANGE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2663,13 +2663,13 @@ code = '''
|
|||||||
prng = 42;
|
prng = 42;
|
||||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, 0) => 0;
|
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, 0) => 0;
|
||||||
for (lfs_size_t i = 0; i < count; i++) {
|
for (lfs_size_t i = 0; i < count; i++) {
|
||||||
uint8_t x
|
lfs_size_t x
|
||||||
= (ORDER == 0) ? (uint8_t)i
|
= (ORDER == 0) ? i
|
||||||
: (ORDER == 1) ? (uint8_t)(((lfs_size_t)-1) - i)
|
: (ORDER == 1) ? (((lfs_size_t)-1) - i)
|
||||||
: (uint8_t)TEST_PRNG(&prng);
|
: TEST_PRNG(&prng);
|
||||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(x),
|
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(x & 0x7f),
|
||||||
&id_, &tag_, NULL, &data_) => 0;
|
&id_, &tag_, NULL, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_UATTR(x));
|
assert(tag_ == LFSR_TAG_UATTR(x & 0x7f));
|
||||||
assert(id_ == -1);
|
assert(id_ == -1);
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
}
|
}
|
||||||
@@ -11852,7 +11852,7 @@ code = '''
|
|||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), 0,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), 0,
|
||||||
names[perm[j] % 6], 2))) => 0;
|
names[perm[j] % 6], 2))) => 0;
|
||||||
}
|
}
|
||||||
assert(rbyd.weight == N);
|
assert(rbyd.weight == N);
|
||||||
@@ -11867,7 +11867,7 @@ code = '''
|
|||||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
|
|
||||||
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11940,7 +11940,7 @@ code = '''
|
|||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), 0,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), 0,
|
||||||
names[perm[j] % 6], 2))) => 0;
|
names[perm[j] % 6], 2))) => 0;
|
||||||
}
|
}
|
||||||
assert(rbyd.weight == N);
|
assert(rbyd.weight == N);
|
||||||
@@ -11984,7 +11984,7 @@ code = '''
|
|||||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, id_, lfsr_tag_next(tag_),
|
lfsr_rbyd_lookupnext(&lfs, &rbyd, id_, lfsr_tag_next(tag_),
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 0);
|
assert(weight_ == 0);
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
@@ -12000,7 +12000,7 @@ code = '''
|
|||||||
} else {
|
} else {
|
||||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12078,7 +12078,7 @@ code = '''
|
|||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), 0,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), 0,
|
||||||
names[perm[j] % 6], 2))) => 0;
|
names[perm[j] % 6], 2))) => 0;
|
||||||
}
|
}
|
||||||
assert(rbyd.weight == N);
|
assert(rbyd.weight == N);
|
||||||
@@ -12102,7 +12102,7 @@ code = '''
|
|||||||
|
|
||||||
// replace with bitwise inverse
|
// replace with bitwise inverse
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0xff), 0,
|
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0x7f), 0,
|
||||||
names[j % 6], 3))) => 0;
|
names[j % 6], 3))) => 0;
|
||||||
|
|
||||||
// try traversing over the tags
|
// try traversing over the tags
|
||||||
@@ -12123,12 +12123,12 @@ code = '''
|
|||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 0);
|
assert(weight_ == 0);
|
||||||
assert(lfsr_data_size(data_) == 3);
|
assert(lfsr_data_size(data_) == 3);
|
||||||
} else {
|
} else {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 0);
|
assert(weight_ == 0);
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
@@ -12141,10 +12141,10 @@ code = '''
|
|||||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 3);
|
assert(lfsr_data_size(data_) == 3);
|
||||||
} else {
|
} else {
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12218,7 +12218,7 @@ code = '''
|
|||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), 0,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), 0,
|
||||||
names[perm[j] % 6], 2),
|
names[perm[j] % 6], 2),
|
||||||
LFSR_ATTR(id, SATTR(0), 0, names[perm[j] % 6], 1))) => 0;
|
LFSR_ATTR(id, SATTR(0), 0, names[perm[j] % 6], 1))) => 0;
|
||||||
}
|
}
|
||||||
@@ -12234,7 +12234,7 @@ code = '''
|
|||||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
|
|
||||||
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12307,7 +12307,7 @@ code = '''
|
|||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), 0,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), 0,
|
||||||
names[perm[j] % 6], 2),
|
names[perm[j] % 6], 2),
|
||||||
LFSR_ATTR(id, SATTR(0), 0, names[perm[j] % 6], 1))) => 0;
|
LFSR_ATTR(id, SATTR(0), 0, names[perm[j] % 6], 1))) => 0;
|
||||||
}
|
}
|
||||||
@@ -12352,7 +12352,7 @@ code = '''
|
|||||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, id_, lfsr_tag_next(tag_),
|
lfsr_rbyd_lookupnext(&lfs, &rbyd, id_, lfsr_tag_next(tag_),
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 0);
|
assert(weight_ == 0);
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
@@ -12375,7 +12375,7 @@ code = '''
|
|||||||
} else {
|
} else {
|
||||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12453,7 +12453,7 @@ code = '''
|
|||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
LFSR_ATTR(id, REG, +1, names[perm[j] % 6], 4),
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), 0,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), 0,
|
||||||
names[perm[j] % 6], 2),
|
names[perm[j] % 6], 2),
|
||||||
LFSR_ATTR(id, SATTR(0), 0, names[perm[j] % 6], 1))) => 0;
|
LFSR_ATTR(id, SATTR(0), 0, names[perm[j] % 6], 1))) => 0;
|
||||||
}
|
}
|
||||||
@@ -12478,7 +12478,7 @@ code = '''
|
|||||||
|
|
||||||
// replace with bitwise inverse
|
// replace with bitwise inverse
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0xff), 0,
|
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0x7f), 0,
|
||||||
names[j % 6], 3))) => 0;
|
names[j % 6], 3))) => 0;
|
||||||
|
|
||||||
// try traversing over the tags
|
// try traversing over the tags
|
||||||
@@ -12499,12 +12499,12 @@ code = '''
|
|||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 0);
|
assert(weight_ == 0);
|
||||||
assert(lfsr_data_size(data_) == 3);
|
assert(lfsr_data_size(data_) == 3);
|
||||||
} else {
|
} else {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 0);
|
assert(weight_ == 0);
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
@@ -12524,10 +12524,10 @@ code = '''
|
|||||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 3);
|
assert(lfsr_data_size(data_) == 3);
|
||||||
} else {
|
} else {
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 2);
|
assert(lfsr_data_size(data_) == 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12600,7 +12600,7 @@ code = '''
|
|||||||
|
|
||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), +1,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), +1,
|
||||||
names[perm[j] % 6], 4))) => 0;
|
names[perm[j] % 6], 4))) => 0;
|
||||||
}
|
}
|
||||||
assert(rbyd.weight == N);
|
assert(rbyd.weight == N);
|
||||||
@@ -12615,7 +12615,7 @@ code = '''
|
|||||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
|
|
||||||
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12687,7 +12687,7 @@ code = '''
|
|||||||
|
|
||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), +1,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), +1,
|
||||||
names[perm[j] % 6], 4))) => 0;
|
names[perm[j] % 6], 4))) => 0;
|
||||||
}
|
}
|
||||||
assert(rbyd.weight == N);
|
assert(rbyd.weight == N);
|
||||||
@@ -12724,17 +12724,17 @@ code = '''
|
|||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(id_ == k+1);
|
assert(id_ == k+1);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k+1 + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k+1 + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 2);
|
assert(weight_ == 2);
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
} else if (k > j) {
|
} else if (k > j) {
|
||||||
assert(id_ == k+1);
|
assert(id_ == k+1);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k+1 + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k+1 + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 1);
|
assert(weight_ == 1);
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
} else {
|
} else {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 1);
|
assert(weight_ == 1);
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
}
|
}
|
||||||
@@ -12750,7 +12750,7 @@ code = '''
|
|||||||
} else {
|
} else {
|
||||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12827,7 +12827,7 @@ code = '''
|
|||||||
|
|
||||||
// give each attr a subtype based on its id + SHIFT
|
// give each attr a subtype based on its id + SHIFT
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0xff), +1,
|
LFSR_ATTR(id, UATTR((perm[j] + SHIFT) & 0x7f), +1,
|
||||||
names[perm[j] % 6], 4))) => 0;
|
names[perm[j] % 6], 4))) => 0;
|
||||||
}
|
}
|
||||||
assert(rbyd.weight == N);
|
assert(rbyd.weight == N);
|
||||||
@@ -12851,7 +12851,7 @@ code = '''
|
|||||||
|
|
||||||
// replace with bitwise inverse
|
// replace with bitwise inverse
|
||||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0xff), 0,
|
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0x7f), 0,
|
||||||
names[j % 6], 6))) => 0;
|
names[j % 6], 6))) => 0;
|
||||||
|
|
||||||
// try traversing over the tags
|
// try traversing over the tags
|
||||||
@@ -12865,12 +12865,12 @@ code = '''
|
|||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 1);
|
assert(weight_ == 1);
|
||||||
assert(lfsr_data_size(data_) == 6);
|
assert(lfsr_data_size(data_) == 6);
|
||||||
} else {
|
} else {
|
||||||
assert(id_ == k);
|
assert(id_ == k);
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(weight_ == 1);
|
assert(weight_ == 1);
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
}
|
}
|
||||||
@@ -12883,10 +12883,10 @@ code = '''
|
|||||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||||
&tag_, &data_) => 0;
|
&tag_, &data_) => 0;
|
||||||
if (k == j) {
|
if (k == j) {
|
||||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 6);
|
assert(lfsr_data_size(data_) == 6);
|
||||||
} else {
|
} else {
|
||||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0xff));
|
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||||
assert(lfsr_data_size(data_) == 4);
|
assert(lfsr_data_size(data_) == 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user