Rename the lzw.decoder.lw field

This commit is contained in:
Nigel Tao committed 2019-02-09 14:03:53 +11:00
1 parent 0842bc7115
commit f792ce7bc3
2 files changed
+13 -11

No files matched your search

+5 -4
View File
@@ -3053,7 +3053,7 @@ struct wuffs_lzw__decoder__struct {
uint32_t magic;
uint32_t active_coroutine;
uint32_t f_lw;
uint32_t f_set_literal_width_arg;
uint32_t f_literal_width;
uint32_t f_clear_code;
uint32_t f_end_code;
@@ -8039,7 +8039,7 @@ wuffs_lzw__decoder__set_literal_width(wuffs_lzw__decoder* self, uint32_t a_lw) {
return ((wuffs_base__empty_struct){});
}
self->private_impl.f_lw = a_lw;
self->private_impl.f_set_literal_width_arg = a_lw;
return ((wuffs_base__empty_struct){});
}
@@ -8089,8 +8089,9 @@ wuffs_lzw__decoder__decode_io_writer(wuffs_lzw__decoder* self,
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
self->private_impl.f_literal_width = 8;
if (self->private_impl.f_lw >= 2) {
self->private_impl.f_literal_width = self->private_impl.f_lw;
if (self->private_impl.f_set_literal_width_arg >= 2) {
self->private_impl.f_literal_width =
self->private_impl.f_set_literal_width_arg;
}
self->private_impl.f_clear_code =
(((uint32_t)(1)) << self->private_impl.f_literal_width);
+8 -7
View File
@@ -27,10 +27,11 @@ pri status "?internal error: inconsistent I/O"
pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0
pub struct decoder?(
// The value passed to set_literal_width. This lw field is copied to the
// literal_width field at the start of the decode method. During that
// method, calling set_literal_width will change lw but not literal_width.
lw base.u32[..8],
// set_literal_width_arg is the saved argument passed to set_literal_width.
// This field is copied to the literal_width field at the start of
// decode_io_writer. During that method, calling set_literal_width will
// change set_literal_width_arg but not literal_width.
set_literal_width_arg base.u32[..8],
// read_from state that does not change during a decode call.
literal_width base.u32[..8],
@@ -67,7 +68,7 @@ pub struct decoder?(
)
pub func decoder.set_literal_width!(lw base.u32[2..8]) {
this.lw = args.lw
this.set_literal_width_arg = args.lw
}
pub func decoder.workbuf_len() base.range_ii_u64 {
@@ -79,8 +80,8 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
// Initialize read_from state.
this.literal_width = 8
if this.lw >= 2 {
this.literal_width = this.lw
if this.set_literal_width_arg >= 2 {
this.literal_width = this.set_literal_width_arg
}
this.clear_code = (1 as base.u32) << this.literal_width
this.end_code = this.clear_code + 1