From a205473ad62bcab83e638a9fc09b6334f93a307b Mon Sep 17 00:00:00 2001 From: Dennis Ranke Date: Fri, 9 Sep 2022 08:32:03 +0200 Subject: [PATCH] slight optimization --- c_unpacker/unpack.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/c_unpacker/unpack.c b/c_unpacker/unpack.c index b93d8a3..e7643f3 100644 --- a/c_unpacker/unpack.c +++ b/c_unpacker/unpack.c @@ -81,12 +81,12 @@ int upkr_unpack(void* destination, void* compressed_data) { } prev_was_match = 1; } else { - u8 context_index = 1; - for(int i = 0; i < 8; ++i) { - int bit = upkr_decode_bit(context_index); - context_index = (context_index << 1) + bit; + int byte = 1; + while(byte < 256) { + int bit = upkr_decode_bit(byte); + byte = (byte << 1) + bit; } - *write_ptr++ = context_index; + *write_ptr++ = byte; prev_was_match = 0; } }