mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Rename io_writer.history_available
This commit is contained in:
1 parent
be8542e313
commit
3c3d58bfe7
6 files changed
+39
-39
No files matched your search
@@ -328,7 +328,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
b.printf(", ((uint64_t)(%s%s - %s%s)))", iopPrefix, name, io0Prefix, name)
|
||||
return nil
|
||||
|
||||
case t.IDHistoryAvailable, t.IDMark:
|
||||
case t.IDHistoryLength, t.IDMark:
|
||||
b.printf("((uint64_t)(%s%s - %s%s))", iopPrefix, name, io0Prefix, name)
|
||||
return nil
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ var Funcs = []string{
|
||||
"io_writer.write_u64le_fast!(a: u64)",
|
||||
|
||||
"io_writer.count_since(mark: u64) u64",
|
||||
"io_writer.history_available() u64",
|
||||
"io_writer.history_length() u64",
|
||||
"io_writer.length() u64",
|
||||
"io_writer.mark() u64",
|
||||
"io_writer.position() u64",
|
||||
|
||||
@@ -1122,7 +1122,7 @@ func (q *checker) canLimitedCopyU32FromHistoryFast(recv *a.Expr, args []*a.Node)
|
||||
// As per cgen's io-private.h, there are three pre-conditions:
|
||||
// - n <= this.length()
|
||||
// - distance > 0
|
||||
// - distance <= this.history_available()
|
||||
// - distance <= this.history_length()
|
||||
|
||||
if len(args) != 2 {
|
||||
return fmt.Errorf("check: internal error: inconsistent copy_n_from_history_fast arguments")
|
||||
@@ -1180,7 +1180,7 @@ check1:
|
||||
return fmt.Errorf("check: could not prove distance > 0")
|
||||
}
|
||||
|
||||
// Check "distance <= this.history_available()".
|
||||
// Check "distance <= this.history_length()".
|
||||
check2:
|
||||
for {
|
||||
for _, x := range q.facts {
|
||||
@@ -1198,9 +1198,9 @@ check2:
|
||||
continue
|
||||
}
|
||||
|
||||
// Check that the RHS is "recv.history_available()".
|
||||
// Check that the RHS is "recv.history_length()".
|
||||
y, method, yArgs := splitReceiverMethodArgs(x.RHS().AsExpr())
|
||||
if method != t.IDHistoryAvailable || len(yArgs) != 0 {
|
||||
if method != t.IDHistoryLength || len(yArgs) != 0 {
|
||||
continue
|
||||
}
|
||||
if !y.Eq(recv) {
|
||||
@@ -1209,7 +1209,7 @@ check2:
|
||||
|
||||
break check2
|
||||
}
|
||||
return fmt.Errorf("check: could not prove distance <= %s.history_available()", recv.Str(q.tm))
|
||||
return fmt.Errorf("check: could not prove distance <= %s.history_length()", recv.Str(q.tm))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
+26
-26
@@ -503,19 +503,19 @@ const (
|
||||
|
||||
IDDecodeFrameOptions = ID(0x158)
|
||||
|
||||
IDCanUndoByte = ID(0x160)
|
||||
IDCountSince = ID(0x161)
|
||||
IDHistoryAvailable = ID(0x162)
|
||||
IDIsClosed = ID(0x163)
|
||||
IDMark = ID(0x164)
|
||||
IDMatch15 = ID(0x165)
|
||||
IDMatch31 = ID(0x166)
|
||||
IDMatch7 = ID(0x167)
|
||||
IDPosition = ID(0x168)
|
||||
IDSince = ID(0x169)
|
||||
IDSkip = ID(0x16A)
|
||||
IDSkipU32 = ID(0x16B)
|
||||
IDSkipU32Fast = ID(0x16C)
|
||||
IDCanUndoByte = ID(0x160)
|
||||
IDCountSince = ID(0x161)
|
||||
IDHistoryLength = ID(0x162)
|
||||
IDIsClosed = ID(0x163)
|
||||
IDMark = ID(0x164)
|
||||
IDMatch15 = ID(0x165)
|
||||
IDMatch31 = ID(0x166)
|
||||
IDMatch7 = ID(0x167)
|
||||
IDPosition = ID(0x168)
|
||||
IDSince = ID(0x169)
|
||||
IDSkip = ID(0x16A)
|
||||
IDSkipU32 = ID(0x16B)
|
||||
IDSkipU32Fast = ID(0x16C)
|
||||
|
||||
IDCopyFromSlice = ID(0x170)
|
||||
IDLimitedCopyU32FromHistory = ID(0x171)
|
||||
@@ -870,19 +870,19 @@ var builtInsByID = [nBuiltInIDs]string{
|
||||
|
||||
IDDecodeFrameOptions: "decode_frame_options",
|
||||
|
||||
IDCanUndoByte: "can_undo_byte",
|
||||
IDCountSince: "count_since",
|
||||
IDHistoryAvailable: "history_available",
|
||||
IDIsClosed: "is_closed",
|
||||
IDMark: "mark",
|
||||
IDMatch15: "match15",
|
||||
IDMatch31: "match31",
|
||||
IDMatch7: "match7",
|
||||
IDPosition: "position",
|
||||
IDSince: "since",
|
||||
IDSkip: "skip",
|
||||
IDSkipU32: "skip_u32",
|
||||
IDSkipU32Fast: "skip_u32_fast",
|
||||
IDCanUndoByte: "can_undo_byte",
|
||||
IDCountSince: "count_since",
|
||||
IDHistoryLength: "history_length",
|
||||
IDIsClosed: "is_closed",
|
||||
IDMark: "mark",
|
||||
IDMatch15: "match15",
|
||||
IDMatch31: "match31",
|
||||
IDMatch7: "match7",
|
||||
IDPosition: "position",
|
||||
IDSince: "since",
|
||||
IDSkip: "skip",
|
||||
IDSkipU32: "skip_u32",
|
||||
IDSkipU32Fast: "skip_u32_fast",
|
||||
|
||||
IDCopyFromSlice: "copy_from_slice",
|
||||
IDLimitedCopyU32FromHistory: "limited_copy_u32_from_history",
|
||||
|
||||
@@ -290,12 +290,12 @@ pri func decoder.decode_huffman_fast!(dst: base.io_writer, src: base.io_reader)
|
||||
pre args.dst.length() >= 258,
|
||||
{
|
||||
// Copy from this.history.
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() {
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_length() {
|
||||
// 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.history_available()) as base.u32
|
||||
hdist = (((dist_minus_1 + 1) as base.u64) - args.dst.history_length()) 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)
|
||||
@@ -325,12 +325,12 @@ pri func decoder.decode_huffman_fast!(dst: base.io_writer, src: base.io_reader)
|
||||
continue.loop
|
||||
}
|
||||
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() {
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_length() {
|
||||
return "#internal error: inconsistent distance"
|
||||
}
|
||||
}
|
||||
// Once again, redundant but explicit assertions.
|
||||
assert ((dist_minus_1 + 1) as base.u64) <= args.dst.history_available()
|
||||
assert ((dist_minus_1 + 1) as base.u64) <= args.dst.history_length()
|
||||
assert args.dst.length() >= 258
|
||||
|
||||
// We can therefore prove:
|
||||
|
||||
@@ -203,11 +203,11 @@ pri func decoder.decode_huffman_slow?(dst: base.io_writer, src: base.io_reader)
|
||||
|
||||
while true {
|
||||
// Copy from this.history.
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_available() {
|
||||
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_length() {
|
||||
// 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.
|
||||
hdist = (((dist_minus_1 + 1) as base.u64) - args.dst.history_available()) as base.u32
|
||||
hdist = (((dist_minus_1 + 1) as base.u64) - args.dst.history_length()) 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)
|
||||
|
||||
Reference in new issue
Block a user