[CPU] Fix lzx_decompress misuse of xe::bit_count. Fixes #1402.

This commit is contained in:
gibbed 2019-07-18 12:32:37 -05:00
parent c1f5bf71d8
commit e14639c6c0
1 changed files with 5 additions and 2 deletions

View File

@ -96,10 +96,13 @@ void mspack_memory_sys_destroy(struct mspack_system* sys) { free(sys); }
int lzx_decompress(const void* lzx_data, size_t lzx_len, void* dest, int lzx_decompress(const void* lzx_data, size_t lzx_len, void* dest,
size_t dest_len, uint32_t window_size, void* window_data, size_t dest_len, uint32_t window_size, void* window_data,
size_t window_data_len) { size_t window_data_len) {
uint32_t window_bits = xe::bit_count(window_size);
int result_code = 1; int result_code = 1;
uint32_t window_bits;
if (!xe::bit_scan_forward(window_size, &window_bits)) {
return result_code;
}
mspack_system* sys = mspack_memory_sys_create(); mspack_system* sys = mspack_memory_sys_create();
mspack_memory_file* lzxsrc = mspack_memory_file* lzxsrc =
mspack_memory_open(sys, (void*)lzx_data, lzx_len); mspack_memory_open(sys, (void*)lzx_data, lzx_len);