diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index c8a9d4eb..17e674cb 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -7274,8 +7274,8 @@ wuffs_lzw__decoder__read_from(wuffs_lzw__decoder* self, self->private_impl.f_suffixes[v_save_code][0] = ((uint8_t)(v_code)); } v_save_code += 1; - if ((v_save_code == (((uint32_t)(1)) << v_width)) && (v_width < 12)) { - v_width += 1; + if (v_width < 12) { + v_width += (1 & (v_save_code >> v_width)); } v_prev_code = v_code; } @@ -7333,8 +7333,8 @@ wuffs_lzw__decoder__read_from(wuffs_lzw__decoder* self, ((uint8_t)(v_first_byte)); } v_save_code += 1; - if ((v_save_code == (((uint32_t)(1)) << v_width)) && (v_width < 12)) { - v_width += 1; + if (v_width < 12) { + v_width += (1 & (v_save_code >> v_width)); } v_prev_code = v_code; } diff --git a/std/lzw/decode_lzw.wuffs b/std/lzw/decode_lzw.wuffs index b46fd9b6..76128c88 100644 --- a/std/lzw/decode_lzw.wuffs +++ b/std/lzw/decode_lzw.wuffs @@ -195,8 +195,8 @@ pri func decoder.read_from!(src base.io_reader) { } save_code += 1 - if (save_code == ((1 as base.u32) << width)) and (width < 12) { - width += 1 + if width < 12 { + width += 1 & (save_code >> width) } prev_code = code } @@ -268,8 +268,8 @@ pri func decoder.read_from!(src base.io_reader) { } save_code += 1 - if (save_code == ((1 as base.u32) << width)) and (width < 12) { - width += 1 + if width < 12 { + width += 1 & (save_code >> width) } prev_code = code }