mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
Drop std/deflate's "Re-purpose the hdist variable"
This commit is contained in:
1 parent
49a431f98d
commit
5e8b448c12
5 files changed
+12
-31
No files matched your search
@@ -27334,9 +27334,8 @@ wuffs_deflate__decoder__decode_huffman_bmi2(
|
||||
status = wuffs_base__make_status(wuffs_deflate__error__bad_distance);
|
||||
goto exit;
|
||||
}
|
||||
v_hdist = (self->private_impl.f_history_index - v_hdist);
|
||||
wuffs_base__io_writer__limited_copy_u32_from_slice(
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), (v_hdist & 32767)));
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
|
||||
if (v_length == 0) {
|
||||
goto label__loop__continue;
|
||||
}
|
||||
@@ -27600,9 +27599,8 @@ wuffs_deflate__decoder__decode_huffman_fast32(
|
||||
status = wuffs_base__make_status(wuffs_deflate__error__bad_distance);
|
||||
goto exit;
|
||||
}
|
||||
v_hdist = (self->private_impl.f_history_index - v_hdist);
|
||||
wuffs_base__io_writer__limited_copy_u32_from_slice(
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), (v_hdist & 32767)));
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
|
||||
if (v_length == 0) {
|
||||
goto label__loop__continue;
|
||||
}
|
||||
@@ -27813,9 +27811,8 @@ wuffs_deflate__decoder__decode_huffman_fast64__choosy_default(
|
||||
status = wuffs_base__make_status(wuffs_deflate__error__bad_distance);
|
||||
goto exit;
|
||||
}
|
||||
v_hdist = (self->private_impl.f_history_index - v_hdist);
|
||||
wuffs_base__io_writer__limited_copy_u32_from_slice(
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), (v_hdist & 32767)));
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
|
||||
if (v_length == 0) {
|
||||
goto label__loop__continue;
|
||||
}
|
||||
@@ -28146,9 +28143,8 @@ wuffs_deflate__decoder__decode_huffman_slow(
|
||||
status = wuffs_base__make_status(wuffs_deflate__error__bad_distance);
|
||||
goto exit;
|
||||
}
|
||||
v_hdist = (self->private_impl.f_history_index - v_hdist);
|
||||
v_n_copied = wuffs_base__io_writer__limited_copy_u32_from_slice(
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), (v_hdist & 32767)));
|
||||
&iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
|
||||
if (v_n_copied < v_hlen) {
|
||||
v_length -= v_n_copied;
|
||||
status = wuffs_base__make_status(wuffs_base__suspension__short_write);
|
||||
|
||||
@@ -219,18 +219,14 @@ pri func decoder.decode_huffman_bmi2!(dst: base.io_writer, src: base.io_reader)
|
||||
if this.history_index < hdist {
|
||||
return "#bad distance"
|
||||
}
|
||||
// Re-purpose the hdist variable as the this.history index to
|
||||
// start copying from.
|
||||
hdist = this.history_index - hdist
|
||||
|
||||
// Copy from hdist to the end of this.history.
|
||||
// Copy from this.history[(this.history_index - hdist) ..].
|
||||
//
|
||||
// This copying is simpler than the decode_huffman_slow version
|
||||
// because it cannot yield. We have already checked that
|
||||
// args.dst.length() is large enough.
|
||||
args.dst.limited_copy_u32_from_slice!(
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF ..])
|
||||
|
||||
up_to: hlen, s: this.history[(this.history_index - hdist) & 0x7FFF ..])
|
||||
if length == 0 {
|
||||
// No need to copy from args.dst.
|
||||
continue.loop
|
||||
|
||||
@@ -324,18 +324,14 @@ pri func decoder.decode_huffman_fast32!(dst: base.io_writer, src: base.io_reader
|
||||
if this.history_index < hdist {
|
||||
return "#bad distance"
|
||||
}
|
||||
// Re-purpose the hdist variable as the this.history index to
|
||||
// start copying from.
|
||||
hdist = this.history_index - hdist
|
||||
|
||||
// Copy from hdist to the end of this.history.
|
||||
// Copy from this.history[(this.history_index - hdist) ..].
|
||||
//
|
||||
// This copying is simpler than the decode_huffman_slow version
|
||||
// because it cannot yield. We have already checked that
|
||||
// args.dst.length() is large enough.
|
||||
args.dst.limited_copy_u32_from_slice!(
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF ..])
|
||||
|
||||
up_to: hlen, s: this.history[(this.history_index - hdist) & 0x7FFF ..])
|
||||
if length == 0 {
|
||||
// No need to copy from args.dst.
|
||||
continue.loop
|
||||
|
||||
@@ -218,18 +218,14 @@ pri func decoder.decode_huffman_fast64!(dst: base.io_writer, src: base.io_reader
|
||||
if this.history_index < hdist {
|
||||
return "#bad distance"
|
||||
}
|
||||
// Re-purpose the hdist variable as the this.history index to
|
||||
// start copying from.
|
||||
hdist = this.history_index - hdist
|
||||
|
||||
// Copy from hdist to the end of this.history.
|
||||
// Copy from this.history[(this.history_index - hdist) ..].
|
||||
//
|
||||
// This copying is simpler than the decode_huffman_slow version
|
||||
// because it cannot yield. We have already checked that
|
||||
// args.dst.length() is large enough.
|
||||
args.dst.limited_copy_u32_from_slice!(
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF ..])
|
||||
|
||||
up_to: hlen, s: this.history[(this.history_index - hdist) & 0x7FFF ..])
|
||||
if length == 0 {
|
||||
// No need to copy from args.dst.
|
||||
continue.loop
|
||||
|
||||
@@ -220,13 +220,10 @@ pri func decoder.decode_huffman_slow?(dst: base.io_writer, src: base.io_reader)
|
||||
if this.history_index < hdist {
|
||||
return "#bad distance"
|
||||
}
|
||||
// Re-purpose the hdist variable as the this.history index to
|
||||
// start copying from.
|
||||
hdist = this.history_index - hdist
|
||||
|
||||
// Copy from hdist to the end of this.history.
|
||||
// Copy from this.history[(this.history_index - hdist) ..].
|
||||
n_copied = args.dst.limited_copy_u32_from_slice!(
|
||||
up_to: hlen, s: this.history[hdist & 0x7FFF ..])
|
||||
up_to: hlen, s: this.history[(this.history_index - hdist) & 0x7FFF ..])
|
||||
if n_copied < hlen {
|
||||
assert n_copied < length via "a < b: a < c; c <= b"(c: hlen)
|
||||
assert length > n_copied via "a > b: b < a"()
|
||||
|
||||
Reference in new issue
Block a user