aboutsummaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorMarvin Borner2023-05-21 18:55:31 +0200
committerMarvin Borner2023-05-21 20:29:25 +0200
commit05d9c29717f7ae31dfad9230d469af0fa7f0c761 (patch)
treea7e6547c4d3fc346e853d455f5c1a288505abc31 /src/parse.c
parent7ebabbb0022bce1cd6c05db583acb20d8659a356 (diff)
Applied variadic index length technique
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/parse.c b/src/parse.c
index f6e047d..cf873c6 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -71,9 +71,14 @@ static struct term *parse_bloc_bblc(const char *term, size_t *bit)
(*bit)++;
} else if (!BIT_AT(*bit) && BIT_AT(*bit + 1) && BIT_AT(*bit + 2)) {
(*bit) += 3;
+
+ // selected bit pattern, see readme
+ int sel = (2 << (BIT_AT(*bit) * 2 + BIT_AT(*bit + 1) + 2));
+ (*bit) += 2;
+
res = new_term(REF);
- short index = 0;
- for (int i = 0; i < 16; i++) {
+ size_t index = 0;
+ for (int i = 0; i < sel; i++) {
index |= (BIT_AT(*bit) >> (7 - (*bit % 8))) << i;
(*bit) += 1;
}