mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Drop the 32 in the skip32 and skip32_fast names
This commit is contained in:
1 parent
26eba56f57
commit
a32683e5ea
8 files changed
+31
-34
No files matched your search
@@ -132,7 +132,7 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
|
||||
aPrefix, aPrefix)
|
||||
return nil
|
||||
|
||||
case t.IDSkip32Fast:
|
||||
case t.IDSkipFast:
|
||||
// Generate a two part expression using the comma operator: "(pointer
|
||||
// increment, return_empty_struct call)". The final part is a function
|
||||
// call (to a static inline function) instead of a struct literal, to
|
||||
@@ -469,7 +469,7 @@ func (g *gen) writeBuiltinCallSuspendibles(b *buffer, n *a.Expr, depth uint32) e
|
||||
case t.IDReadU64LE:
|
||||
return g.writeReadUXX(b, n, "src", 64, "le")
|
||||
|
||||
case t.IDSkip32:
|
||||
case t.IDSkip:
|
||||
g.currFunk.usesScratch = true
|
||||
// TODO: don't hard-code [0], and allow recursive coroutines.
|
||||
scratchName := fmt.Sprintf("self->private_impl.%s%s[0].scratch",
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
- Redesigned iterate blocks.
|
||||
- Added a `base.image_config` type.
|
||||
- Added a `reset` method.
|
||||
- Added `peek_uxx` and `skip32_fast` methods.
|
||||
- Added `peek_uxx`, `skip_fast` and `write_fast_uxx` methods.
|
||||
- Tweaked how marks and limits work.
|
||||
- Supported animated (not just single frame) GIFs.
|
||||
- Marked the `std/gif` LZW decoder as private.
|
||||
|
||||
@@ -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)()",
|
||||
|
||||
@@ -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
@@ -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",
|
||||
|
||||
@@ -211,7 +211,7 @@ pri func decoder.decode_lsd?(src base.io_reader)() {
|
||||
this.height = in.src.read_u16le?() as base.u32
|
||||
var flags base.u8 = in.src.read_u8?()
|
||||
// Ignore the Background Color Index and Pixel Aspect Ratio bytes.
|
||||
in.src.skip32?(n:2)
|
||||
in.src.skip?(n:2)
|
||||
|
||||
// Read the optional Global Color Table.
|
||||
if (flags & 0x80) != 0 {
|
||||
@@ -268,7 +268,7 @@ pri func decoder.skip_blocks?(src base.io_reader)() {
|
||||
if block_size == 0 {
|
||||
return
|
||||
}
|
||||
in.src.skip32?(n:block_size as base.u32)
|
||||
in.src.skip?(n:block_size as base.u32)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ pri func decoder.decode_ae?(src base.io_reader)() {
|
||||
// - http://www.vurdalakov.net/misc/gif/animexts-looping-application-extension
|
||||
// - http://www.vurdalakov.net/misc/gif/netscape-looping-application-extension
|
||||
if block_size != 11 {
|
||||
in.src.skip32?(n:block_size as base.u32)
|
||||
in.src.skip?(n:block_size as base.u32)
|
||||
break
|
||||
}
|
||||
var not_animexts base.bool
|
||||
@@ -318,12 +318,12 @@ pri func decoder.decode_ae?(src base.io_reader)() {
|
||||
// count.
|
||||
block_size = in.src.read_u8?()
|
||||
if block_size != 3 {
|
||||
in.src.skip32?(n:block_size as base.u32)
|
||||
in.src.skip?(n:block_size as base.u32)
|
||||
break
|
||||
}
|
||||
c = in.src.read_u8?()
|
||||
if c != 0x01 {
|
||||
in.src.skip32?(n:2)
|
||||
in.src.skip?(n:2)
|
||||
break
|
||||
}
|
||||
this.num_loops = in.src.read_u16le?() as base.u32
|
||||
|
||||
@@ -48,12 +48,12 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
}
|
||||
var flags base.u8 = in.src.read_u8?()
|
||||
// TODO: API for returning the header's MTIME field.
|
||||
in.src.skip32?(n:6)
|
||||
in.src.skip?(n:6)
|
||||
|
||||
// Handle FEXTRA.
|
||||
if (flags & 0x04) != 0 {
|
||||
var xlen base.u16 = in.src.read_u16le?()
|
||||
in.src.skip32?(n:xlen as base.u32)
|
||||
in.src.skip?(n:xlen as base.u32)
|
||||
}
|
||||
|
||||
// Handle FNAME.
|
||||
@@ -82,7 +82,7 @@ pub func decoder.decode?(dst base.io_writer, src base.io_reader)() {
|
||||
|
||||
// Handle FHCRC.
|
||||
if (flags & 0x02) != 0 {
|
||||
in.src.skip32?(n:2)
|
||||
in.src.skip?(n:2)
|
||||
}
|
||||
|
||||
// Reserved flags bits must be zero.
|
||||
|
||||
+1
-1
@@ -591,7 +591,7 @@ void test_wuffs_gif_decode_input_is_a_gif_many_medium_reads() {
|
||||
do_test_wuffs_gif_decode("../../data/bricks-dither.gif",
|
||||
"../../data/bricks-dither.palette",
|
||||
"../../data/bricks-dither.indexes", 787);
|
||||
// The magic 787 tickles being in the middle of a decode_extension skip32
|
||||
// The magic 787 tickles being in the middle of a decode_extension skip
|
||||
// call.
|
||||
//
|
||||
// TODO: has 787 changed since we decode the image_config separately?
|
||||
|
||||
Reference in new issue
Block a user