Skip to content

Commit

Permalink
fix: handle first real symbol in prob=-1 table cases
Browse files Browse the repository at this point in the history
  • Loading branch information
roynalnaruto committed May 15, 2024
1 parent 10a6f87 commit ac0df3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions aggregator/src/aggregation/decoder/tables/fse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,16 @@ impl FseTable {
);
});

// is the first symbol if:
// - prev row was prob=-1
let is_first_symbol = meta.query_advice(config.is_prob_less_than1, Rotation::prev());
cb.condition(is_first_symbol, |cb| {
cb.require_zero(
"first symbol (prob >= 1): state == 0",
meta.query_advice(config.state, Rotation::cur()),
);
});

cb.gate(condition)
});

Expand Down Expand Up @@ -686,6 +696,7 @@ impl FseTable {
not::expr(meta.query_fixed(config.sorted_table.q_first, Rotation::cur())),
not::expr(meta.query_fixed(config.sorted_table.q_start, Rotation::cur())),
not::expr(meta.query_advice(config.is_prob_less_than1, Rotation::cur())),
not::expr(meta.query_advice(config.is_prob_less_than1, Rotation::prev())),
not::expr(meta.query_advice(config.is_padding, Rotation::cur())),
]);

Expand Down

0 comments on commit ac0df3b

Please sign in to comment.