diff options
author | Patrick McHardy <kaber@trash.net> | 2012-12-08 20:42:16 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2012-12-08 20:42:16 +0100 |
commit | 9e33068da715323768bbee39a17cdad8642451ae (patch) | |
tree | c8b13a616d03d30b4a03ead139af6a4a18f8e53c /src/segtree.c | |
parent | 256f41f07998ba63146897019d4282767870108d (diff) |
seqtree: update mapping data when keeping the base
When a prefix expression is followed by another prefix expression using the
same base but a wider prefix, we need to update the mapping data to that of
the second expression.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/segtree.c')
-rw-r--r-- | src/segtree.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/segtree.c b/src/segtree.c index c3206199..356a8b76 100644 --- a/src/segtree.c +++ b/src/segtree.c @@ -540,9 +540,11 @@ void interval_map_decompose(struct expr *set) mpz_set(tmp->value, range); tmp = range_expr_alloc(&low->location, expr_value(low), tmp); + if (low->ops->type == EXPR_MAPPING) + tmp = mapping_expr_alloc(&tmp->location, tmp, low->right); + compound_expr_add(set, tmp); - printf("!prefix: "); expr_print(tmp); printf("\n"); low = expr_get(tmp->right); } else { struct expr *prefix; @@ -552,9 +554,12 @@ void interval_map_decompose(struct expr *set) prefix = prefix_expr_alloc(&low->location, expr_value(low), prefix_len); - if (low->ops->type == EXPR_MAPPING) + if (low->ops->type == EXPR_MAPPING) { prefix = mapping_expr_alloc(&low->location, prefix, - expr_get(low->right)); + low->right); + /* Update mapping of "low" to the current mapping */ + low->right = expr_get(i->right); + } compound_expr_add(set, prefix); } |