Call copy_history32 in a trival 1-iteration loop.

Follow-up commits will re-try copy_history32's across I/O boundaries.
This commit is contained in:
Nigel Tao committed 2017-10-06 14:53:45 +11:00
1 parent d30d4c3dad
commit a1271222a4
2 files changed
+11 -2

No files matched your search

+8 -2
View File
@@ -1314,7 +1314,9 @@ puffs_flate_status puffs_flate_decoder_decode_huffman(
v_distance += ((v_bits) & ((1 << (v_table_entry_n_bits)) - 1));
v_bits >>= v_table_entry_n_bits;
v_n_bits -= v_table_entry_n_bits;
if (((uint64_t)(v_distance)) > ((uint64_t)(b_wptr_dst - b_wstart_dst))) {
while (true) {
if (((uint64_t)(v_distance)) >
((uint64_t)(b_wptr_dst - b_wstart_dst))) {
}
PUFFS_COROUTINE_SUSPENSION_POINT(8);
{
@@ -1323,7 +1325,8 @@ puffs_flate_status puffs_flate_decoder_decode_huffman(
PUFFS_COROUTINE_SUSPENSION_POINT(9);
size_t t_6 =
(size_t)(self->private_impl.c_decode_huffman[0].scratch >> 32);
if (PUFFS_UNLIKELY((t_6 == 0) || (t_6 > (b_wptr_dst - b_wstart_dst)))) {
if (PUFFS_UNLIKELY((t_6 == 0) ||
(t_6 > (b_wptr_dst - b_wstart_dst)))) {
status = PUFFS_FLATE_ERROR_BAD_ARGUMENT;
goto exit;
}
@@ -1354,6 +1357,9 @@ puffs_flate_status puffs_flate_decoder_decode_huffman(
goto suspend;
}
}
goto label_5_break;
}
label_5_break:;
}
label_0_break:;
self->private_impl.f_bits = v_bits;
+3
View File
@@ -341,9 +341,12 @@ pri func decoder.decode_huffman?(dst writer1, src reader1)() {
// TODO: copy_history32 should also take some notion of how much of dst
// is valid. When copying from a distance greater than that, we also
// need to keep a sliding window of previous history.
while true {
if (distance as u64) > in.dst.length() {
}
in.dst.copy_history32?(distance:distance, length:length)
break
}
}
this.bits = bits