Skip to content

Commit

Permalink
Fix case of compress_max_bits >8
Browse files Browse the repository at this point in the history
  • Loading branch information
jepler committed Feb 15, 2022
1 parent fea9af5 commit e8b9bba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions supervisor/shared/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ STATIC int put_utf8(char *buf, int u) {
}

uint16_t decompress_length(const compressed_string_t *compressed) {
if (compress_max_length_bits <= 8) {
return 1 + (compressed->data >> (8 - compress_max_length_bits));
} else {
return 1 + ((compressed->data * 256 + compressed->tail[0]) >> (16 - compress_max_length_bits));
}
#if (compress_max_length_bits <= 8)
return 1 + (compressed->data >> (8 - compress_max_length_bits));
#else
return 1 + ((compressed->data * 256 + compressed->tail[0]) >> (16 - compress_max_length_bits));
#endif
}

char *decompress(const compressed_string_t *compressed, char *decompressed) {
Expand Down

0 comments on commit e8b9bba

Please sign in to comment.