mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Micro-optimise the hot next_tag function.
This commit is contained in:
parent
c136424140
commit
2fada9fb76
15
rzip.c
15
rzip.c
|
|
@ -433,19 +433,14 @@ again:
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline tag next_tag(rzip_control *control, struct rzip_state *st, i64 p, tag t)
|
static inline void next_tag(rzip_control *control, struct rzip_state *st, i64 p, tag *t)
|
||||||
{
|
{
|
||||||
uchar *u;
|
uchar *u;
|
||||||
|
|
||||||
u = control->get_sb(control, p - 1);
|
u = control->get_sb(control, p - 1);
|
||||||
if (unlikely(!u))
|
*t ^= st->hash_index[*u];
|
||||||
return -1;
|
|
||||||
t ^= st->hash_index[*u];
|
|
||||||
u = control->get_sb(control, p + MINIMUM_MATCH - 1);
|
u = control->get_sb(control, p + MINIMUM_MATCH - 1);
|
||||||
if (unlikely(!u))
|
*t ^= st->hash_index[*u];
|
||||||
return -1;
|
|
||||||
t ^= st->hash_index[*u];
|
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline tag full_tag(rzip_control *control, struct rzip_state *st, i64 p)
|
static inline tag full_tag(rzip_control *control, struct rzip_state *st, i64 p)
|
||||||
|
|
@ -618,9 +613,7 @@ static bool hash_search(rzip_control *control, struct rzip_state *st, double pct
|
||||||
sb->offset_search = p;
|
sb->offset_search = p;
|
||||||
if (unlikely(sb->offset_search > sb->offset_low + sb->size_low))
|
if (unlikely(sb->offset_search > sb->offset_low + sb->size_low))
|
||||||
remap_low_sb(control, &control->sb);
|
remap_low_sb(control, &control->sb);
|
||||||
t = next_tag(control, st, p, t);
|
next_tag(control, st, p, &t);
|
||||||
if (unlikely(t == -1))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Don't look for a match if there are no tags with
|
/* Don't look for a match if there are no tags with
|
||||||
this number of bits in the hash table. */
|
this number of bits in the hash table. */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue