Drop the 32 in the skip32 and skip32_fast names

This commit is contained in:
Nigel Tao committed 2018-07-08 14:02:32 +10:00
1 parent 26eba56f57
commit a32683e5ea
8 files changed
+31 -34

No files matched your search

+5 -6
View File
@@ -160,7 +160,7 @@ var Funcs = []string{
// TODO: these should have an explicit precondition "available() >= N". For
// now, that's implicitly checked (i.e. hard coded).
//
// The io_reader has peek_etc methods and skip_fast32, not read_etc_fast,
// The io_reader has peek_etc methods and skip_fast, not read_etc_fast,
// because we sometimes advance the pointer by less than what's read. See
// https://fgiesen.wordpress.com/2018/02/20/reading-bits-in-far-too-many-ways-part-2/
"io_reader.peek_u8()(ret u8)",
@@ -185,14 +185,13 @@ var Funcs = []string{
"io_reader.set_mark!()()",
"io_reader.since_mark()(ret slice u8)",
"io_reader.skip32?(n u32)()",
"io_reader.skip64?(n u64)()",
"io_reader.skip?(n u32)()",
// TODO: this should have explicit preconditions "actual <= worst_case" and
// "worst_case <= available()". As an implementation restriction, we also
// require that worst_case has a constant value. For now, that's all
// implicitly checked (i.e. hard coded).
"io_reader.skip32_fast!(actual u32, worst_case u32)()",
"io_reader.skip_fast!(actual u32, worst_case u32)()",
// ---- io_writer
@@ -215,8 +214,8 @@ var Funcs = []string{
// TODO: these should have an explicit precondition "available() >= N". For
// now, that's implicitly checked (i.e. hard coded).
//
// The io_writer has write_fast_etc methods, not poke_etc and skip_fast32,
// because skip32_fast could leave uninitialized bytes in the io_buffer.
// The io_writer has write_fast_etc methods, not poke_etc and skip_fast,
// because skip_fast could leave uninitialized bytes in the io_buffer.
"io_writer.write_fast_u8!(x u8)()",
"io_writer.write_fast_u16be!(x u16)()",
"io_writer.write_fast_u16le!(x u16)()",
+4 -4
View File
@@ -985,22 +985,22 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (a.Bounds,
} else if recvTyp.IsIOType() {
advance, update := (*big.Int)(nil), false
if method == t.IDSkip32Fast {
if method == t.IDSkipFast {
args := n.Args()
if len(args) != 2 {
return a.Bounds{}, fmt.Errorf("check: internal error: bad skip32_fast arguments")
return a.Bounds{}, fmt.Errorf("check: internal error: bad skip_fast arguments")
}
actual := args[0].AsArg().Value()
worstCase := args[1].AsArg().Value()
if err := q.proveBinaryOp(t.IDXBinaryLessEq, actual, worstCase); err == errFailed {
return a.Bounds{}, fmt.Errorf("check: could not prove skip32_fast precondition: %s <= %s",
return a.Bounds{}, fmt.Errorf("check: could not prove skip_fast precondition: %s <= %s",
actual.Str(q.tm), worstCase.Str(q.tm))
} else if err != nil {
return a.Bounds{}, err
}
advance, update = worstCase.ConstValue(), true
if advance == nil {
return a.Bounds{}, fmt.Errorf("check: skip32_fast worst_case is not a constant value")
return a.Bounds{}, fmt.Errorf("check: skip_fast worst_case is not a constant value")
}
} else if method >= t.IDPeekU8 {
+10 -12
View File
@@ -510,12 +510,11 @@ const (
IDWriteFastU64BE = ID(0x17E)
IDWriteFastU64LE = ID(0x17F)
IDSetLimit = ID(0x180)
IDSetMark = ID(0x181)
IDSinceMark = ID(0x182)
IDSkip32 = ID(0x183)
IDSkip32Fast = ID(0x184)
IDSkip64 = ID(0x185)
IDSetLimit = ID(0x180)
IDSetMark = ID(0x181)
IDSinceMark = ID(0x182)
IDSkip = ID(0x183)
IDSkipFast = ID(0x184)
IDCopyFromSlice = ID(0x190)
IDCopyNFromHistory = ID(0x191)
@@ -787,12 +786,11 @@ var builtInsByID = [nBuiltInIDs]string{
IDWriteFastU64BE: "write_fast_u64be",
IDWriteFastU64LE: "write_fast_u64le",
IDSetLimit: "set_limit",
IDSetMark: "set_mark",
IDSinceMark: "since_mark",
IDSkip32: "skip32",
IDSkip32Fast: "skip32_fast",
IDSkip64: "skip64",
IDSetLimit: "set_limit",
IDSetMark: "set_mark",
IDSinceMark: "since_mark",
IDSkip: "skip",
IDSkipFast: "skip_fast",
IDCopyFromSlice: "copy_from_slice",
IDCopyNFromHistory: "copy_n_from_history",