Skip to content
Snippets Groups Projects
Commit 2622a957 authored by Vadim Vygonets's avatar Vadim Vygonets Committed by Scott Vokes
Browse files

Remove unreachable encoder states

Conflicts:
	heatshrink_encoder.c
parent 580efc2a
No related branches found
No related tags found
No related merge requests found
......@@ -26,13 +26,10 @@ digraph {
yield_tag_bit->yield_tag_bit [label="poll(), full buf", color="red"]
yield_tag_bit->yield_literal [label="poll(), literal", color="red"]
yield_tag_bit->yield_br_index [label="poll(), no literal", color="red"]
yield_tag_bit->flush_bits [label="finishing, no literal"]
yield_tag_bit->yield_br_index [label="poll(), match", color="red"]
yield_literal->yield_literal [label="poll(), full buf", color="red"]
yield_literal->search [label="poll(), no match", color="red"]
yield_literal->yield_tag_bit [label="poll(), match", color="red"]
yield_literal->flush_bits [label="poll(), final literal", color="red"]
yield_literal->search [label="done"]
yield_br_index->yield_br_index [label="poll(), full buf", color="red"]
yield_br_index->yield_br_length [label="poll()", color="red"]
......@@ -40,8 +37,7 @@ digraph {
yield_br_length->yield_br_length [label="poll(), full buf", color="red"]
yield_br_length->search [label="done"]
save_backlog->flush_bits [label="finishing, no literal"]
save_backlog->yield_tag_bit [label="finishing, literal"]
save_backlog->flush_bits [label="finishing"]
save_backlog->not_full [label="expect more input"]
flush_bits->flush_bits [label="poll(), full buf", color="red"]
......
......@@ -62,7 +62,6 @@ static int can_take_byte(output_info *oi);
static int is_finishing(heatshrink_encoder *hse);
static int on_final_literal(heatshrink_encoder *hse);
static void save_backlog(heatshrink_encoder *hse);
static int has_literal(heatshrink_encoder *hse);
/* Push COUNT (max 8) bits to the output buffer, which has room. */
static void push_bits(heatshrink_encoder *hse, uint8_t count, uint8_t bits,
......@@ -292,7 +291,6 @@ static HSE_state st_step_search(heatshrink_encoder *hse) {
if (match_pos == MATCH_NOT_FOUND) {
LOG("ss Match not found\n");
hse->match_scan_index++;
hse->flags |= FLAG_HAS_LITERAL;
hse->match_length = 0;
return HSES_YIELD_TAG_BIT;
} else {
......@@ -326,9 +324,7 @@ static HSE_state st_yield_literal(heatshrink_encoder *hse,
output_info *oi) {
if (can_take_byte(oi)) {
push_literal_byte(hse, oi);
hse->flags &= ~FLAG_HAS_LITERAL;
if (on_final_literal(hse)) { return HSES_FLUSH_BITS; }
return hse->match_length > 0 ? HSES_YIELD_TAG_BIT : HSES_SEARCH;
return HSES_SEARCH;
} else {
return HSES_YIELD_LITERAL;
}
......@@ -368,13 +364,7 @@ static HSE_state st_yield_br_length(heatshrink_encoder *hse,
static HSE_state st_save_backlog(heatshrink_encoder *hse) {
if (is_finishing(hse)) {
/* copy remaining literal (if necessary) */
if (has_literal(hse)) {
hse->flags |= FLAG_ON_FINAL_LITERAL;
return HSES_YIELD_TAG_BIT;
} else {
return HSES_FLUSH_BITS;
}
return HSES_FLUSH_BITS;
} else {
LOG("-- saving backlog\n");
save_backlog(hse);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment