Optimized comparison of two buffers.
More...
|
#define | LZMA_MEMCMPLEN_EXTRA 0 |
|
|
static uint32_t | lzma_attribute ((__always_inline__)) lzma_memcmplen(const uint8_t *buf1 |
|
| assert (limit<=UINT32_MAX/2) |
|
| while (len< limit &&buf1[len]==buf2[len])++len |
|
|
static uint32_t const uint8_t * | buf2 |
|
static uint32_t const uint8_t uint32_t | len |
|
static uint32_t const uint8_t uint32_t uint32_t | limit |
|
Optimized comparison of two buffers.
§ lzma_attribute()
static uint32_t lzma_attribute |
( |
(__always_inline__) |
| ) |
const |
|
inlinestatic |
Find out how many equal bytes the two buffers have.
- Parameters
-
buf1 | First buffer |
buf2 | Second buffer |
len | How many bytes have already been compared and will be assumed to match |
limit | How many bytes to compare at most, including the already-compared bytes. This must be significantly smaller than UINT32_MAX to avoid integer overflows. Up to LZMA_MEMCMPLEN_EXTRA bytes may be read past the specified limit from both buf1 and buf2. |
- Returns
- Number of equal bytes in the buffers is returned. This is always at least len and at most limit.
- Note
- LZMA_MEMCMPLEN_EXTRA defines how many extra bytes may be read. It's rounded up to 2^n. This extra amount needs to be allocated in the buffers being used. It needs to be initialized too to keep Valgrind quiet.
§ limit
uint32_t const uint8_t uint32_t uint32_t limit |