diff --git a/lang/check/bounds.go b/lang/check/bounds.go index a2d36ef0..6e3c7d96 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -1113,10 +1113,10 @@ func (q *checker) canUndoByte(recv *a.Expr) error { } func (q *checker) canCopyNFromHistoryFast(recv *a.Expr, args []*a.Node) error { - // As per cgen's base-private.h, there are three pre-conditions: + // As per cgen's io-private.h, there are three pre-conditions: // - n <= this.available() // - distance > 0 - // - distance <= this.since_mark().length() + // - distance <= this.history_available() if len(args) != 2 { return fmt.Errorf("check: internal error: inconsistent copy_n_from_history_fast arguments") @@ -1174,7 +1174,7 @@ check1: return fmt.Errorf("check: could not prove distance > 0") } - // Check "distance <= this.since_mark().length()". + // Check "distance <= this.history_available()". check2: for { for _, x := range q.facts { @@ -1192,22 +1192,18 @@ check2: continue } - // Check that the RHS is "recv.since_mark().length()". + // Check that the RHS is "recv.history_available()". y, method, yArgs := splitReceiverMethodArgs(x.RHS().AsExpr()) - if method != t.IDLength || len(yArgs) != 0 { + if method != t.IDHistoryAvailable || len(yArgs) != 0 { continue } - z, method, zArgs := splitReceiverMethodArgs(y) - if method != t.IDSinceMark || len(zArgs) != 0 { - continue - } - if !z.Eq(recv) { + if !y.Eq(recv) { continue } break check2 } - return fmt.Errorf("check: could not prove distance <= %s.since_mark().length()", recv.Str(q.tm)) + return fmt.Errorf("check: could not prove distance <= %s.history_available()", recv.Str(q.tm)) } return nil diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index e0a0e062..41ab2b08 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -7709,11 +7709,11 @@ label_0_continue:; v_n_copied = 0; while (true) { if (((uint64_t)((v_dist_minus_1 + 1))) > - ((uint64_t)(iop_a_dst - a_dst.private_impl.mark))) { + ((uint64_t)(iop_a_dst - a_dst.private_impl.buf->data.ptr))) { v_hlen = 0; - v_hdist = - ((uint32_t)((((uint64_t)((v_dist_minus_1 + 1))) - - ((uint64_t)(iop_a_dst - a_dst.private_impl.mark))))); + v_hdist = ((uint32_t)( + (((uint64_t)((v_dist_minus_1 + 1))) - + ((uint64_t)(iop_a_dst - a_dst.private_impl.buf->data.ptr))))); if (v_length > v_hdist) { v_length -= v_hdist; v_hlen = v_hdist; @@ -7747,7 +7747,7 @@ label_0_continue:; goto label_0_continue; } if (((uint64_t)((v_dist_minus_1 + 1))) > - ((uint64_t)(iop_a_dst - a_dst.private_impl.mark))) { + ((uint64_t)(iop_a_dst - a_dst.private_impl.buf->data.ptr))) { status = wuffs_deflate__error__internal_error_inconsistent_distance; goto exit; } diff --git a/std/deflate/decode_huffman_fast.wuffs b/std/deflate/decode_huffman_fast.wuffs index d98af1ce..6fa3c5f3 100644 --- a/std/deflate/decode_huffman_fast.wuffs +++ b/std/deflate/decode_huffman_fast.wuffs @@ -292,12 +292,12 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba pre args.dst.available() >= 258, { // Copy from this.history. - if ((dist_minus_1 + 1) as base.u64) > args.dst.since_mark().length() { + if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() { // Set (hlen, hdist) to be the length-distance pair to copy // from this.history, and (length, distance) to be the // remaining length-distance pair to copy from args.dst. hlen = 0 - hdist = (((dist_minus_1 + 1) as base.u64) - args.dst.since_mark().length()) as base.u32 + hdist = (((dist_minus_1 + 1) as base.u64) - args.dst.history_available()) as base.u32 if length > hdist { assert hdist < length via "a < b: b > a"() assert hdist < 0x8000 via "a < b: a < c; c <= b"(c:length) @@ -345,12 +345,12 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba continue:loop } - if ((dist_minus_1 + 1) as base.u64) > args.dst.since_mark().length() { + if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() { return "#internal error: inconsistent distance" } } // Once again, redundant but explicit assertions. - assert ((dist_minus_1 + 1) as base.u64) <= args.dst.since_mark().length() + assert ((dist_minus_1 + 1) as base.u64) <= args.dst.history_available() assert args.dst.available() >= 258 // We can therefore prove: