Commit 12a94f75 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

56 bits for FS are not enough for lage block situations. Fixed

parent 67aee429
......@@ -271,16 +271,23 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm)
*/
uint32_t fs = 0;
#ifdef HAVE_DECL___BUILTIN_CLZLL
uint32_t clz;
#endif
struct internal_state *state = strm->state;
state->acc &= ((1ULL << state->bitp) - 1);
if (state->acc == 0)
while (state->acc == 0) {
fs += state->bitp;
state->bitp = 0;
fill_acc(strm);
}
#ifdef HAVE_DECL___BUILTIN_CLZLL
fs = __builtin_clzll(state->acc) - (64 - state->bitp);
state->bitp -= fs + 1;
clz = __builtin_clzll(state->acc);
fs += clz + state->bitp - 64;
state->bitp = 63 - clz;
#else
state->bitp--;
while ((state->acc & (1ULL << state->bitp)) == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment