Skip to content
Snippets Groups Projects
Commit 4e31a819 authored by Vadim Vygonets's avatar Vadim Vygonets
Browse files

Fix debug output and asserts

parent 0e4f18a2
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,10 @@ static const char *state_names[] = {
"empty",
"input_available",
"yield_literal",
"backref_index",
"backref_count",
"backref_index_msb",
"backref_index_lsb",
"backref_count_msb",
"backref_count_lsb",
"yield_backref",
"check_for_more_input",
};
......@@ -280,7 +282,7 @@ static HSD_state st_yield_backref(heatshrink_decoder *hsd,
uint16_t neg_offset = hsd->output_index;
LOG("-- emitting %zu bytes from -%u bytes back\n", count, neg_offset);
ASSERT(neg_offset < mask + 1);
ASSERT(count <= 1 << BACKREF_COUNT_BITS(hsd));
ASSERT(count <= (size_t)(1 << BACKREF_COUNT_BITS(hsd)));
for (size_t i=0; i<count; i++) {
uint8_t c = buf[(hsd->head_index - neg_offset) & mask];
......
......@@ -312,7 +312,7 @@ static HSE_state st_step_search(heatshrink_encoder *hse) {
LOG("ss Found match of %d bytes at %d\n", match_length, match_pos);
hse->match_pos = match_pos;
hse->match_length = match_length;
ASSERT(match_pos < 1 << hse->window_sz2 /*window_length*/);
ASSERT(match_pos < 1 << HEATSHRINK_ENCODER_WINDOW_BITS(hse) /*window_length*/);
return HSES_YIELD_TAG_BIT;
}
......
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