slight optimization

This commit is contained in:
2022-09-09 08:32:03 +02:00
parent 4903ac3786
commit a205473ad6

View File

@@ -81,12 +81,12 @@ int upkr_unpack(void* destination, void* compressed_data) {
} }
prev_was_match = 1; prev_was_match = 1;
} else { } else {
u8 context_index = 1; int byte = 1;
for(int i = 0; i < 8; ++i) { while(byte < 256) {
int bit = upkr_decode_bit(context_index); int bit = upkr_decode_bit(byte);
context_index = (context_index << 1) + bit; byte = (byte << 1) + bit;
} }
*write_ptr++ = context_index; *write_ptr++ = byte;
prev_was_match = 0; prev_was_match = 0;
} }
} }