diff options
Diffstat (limited to 'Utilities/cmliblzma/liblzma/simple/x86.c')
-rw-r--r-- | Utilities/cmliblzma/liblzma/simple/x86.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Utilities/cmliblzma/liblzma/simple/x86.c b/Utilities/cmliblzma/liblzma/simple/x86.c index 5d1509b..101d8ed 100644 --- a/Utilities/cmliblzma/liblzma/simple/x86.c +++ b/Utilities/cmliblzma/liblzma/simple/x86.c @@ -36,30 +36,36 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, uint32_t prev_mask = simple->prev_mask; uint32_t prev_pos = simple->prev_pos; + size_t limit; + size_t buffer_pos; + if (size < 5) return 0; if (now_pos - prev_pos > 5) prev_pos = now_pos - 5; - const size_t limit = size - 5; - size_t buffer_pos = 0; + limit = size - 5; + buffer_pos = 0; while (buffer_pos <= limit) { + uint32_t offset; + uint32_t i; + uint8_t b = buffer[buffer_pos]; if (b != 0xE8 && b != 0xE9) { ++buffer_pos; continue; } - const uint32_t offset = now_pos + (uint32_t)(buffer_pos) + offset = now_pos + (uint32_t)(buffer_pos) - prev_pos; prev_pos = now_pos + (uint32_t)(buffer_pos); if (offset > 5) { prev_mask = 0; } else { - for (uint32_t i = 0; i < offset; ++i) { + for (i = 0; i < offset; ++i) { prev_mask &= 0x77; prev_mask <<= 1; } @@ -78,6 +84,8 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, uint32_t dest; while (true) { + uint32_t i; + if (is_encoder) dest = src + (now_pos + (uint32_t)( buffer_pos) + 5); @@ -88,8 +96,7 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder, if (prev_mask == 0) break; - const uint32_t i = MASK_TO_BIT_NUMBER[ - prev_mask >> 1]; + i = MASK_TO_BIT_NUMBER[prev_mask >> 1]; b = (uint8_t)(dest >> (24 - i * 8)); |