mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
Rename some built-in func's arg from x to a
This commit is contained in:
1 parent
851b7561d9
commit
2819fb8e3f
4 files changed
+55
-57
No files matched your search
+38
-38
@@ -90,23 +90,23 @@ var Types = []string{
|
|||||||
var Funcs = []string{
|
var Funcs = []string{
|
||||||
"u8.high_bits(n u32[..8]) u8",
|
"u8.high_bits(n u32[..8]) u8",
|
||||||
"u8.low_bits(n u32[..8]) u8",
|
"u8.low_bits(n u32[..8]) u8",
|
||||||
"u8.max(x u8) u8",
|
"u8.max(a u8) u8",
|
||||||
"u8.min(x u8) u8",
|
"u8.min(a u8) u8",
|
||||||
|
|
||||||
"u16.high_bits(n u32[..16]) u16",
|
"u16.high_bits(n u32[..16]) u16",
|
||||||
"u16.low_bits(n u32[..16]) u16",
|
"u16.low_bits(n u32[..16]) u16",
|
||||||
"u16.max(x u16) u16",
|
"u16.max(a u16) u16",
|
||||||
"u16.min(x u16) u16",
|
"u16.min(a u16) u16",
|
||||||
|
|
||||||
"u32.high_bits(n u32[..32]) u32",
|
"u32.high_bits(n u32[..32]) u32",
|
||||||
"u32.low_bits(n u32[..32]) u32",
|
"u32.low_bits(n u32[..32]) u32",
|
||||||
"u32.max(x u32) u32",
|
"u32.max(a u32) u32",
|
||||||
"u32.min(x u32) u32",
|
"u32.min(a u32) u32",
|
||||||
|
|
||||||
"u64.high_bits(n u32[..64]) u64",
|
"u64.high_bits(n u32[..64]) u64",
|
||||||
"u64.low_bits(n u32[..64]) u64",
|
"u64.low_bits(n u32[..64]) u64",
|
||||||
"u64.max(x u64) u64",
|
"u64.max(a u64) u64",
|
||||||
"u64.min(x u64) u64",
|
"u64.min(a u64) u64",
|
||||||
|
|
||||||
// ---- utility
|
// ---- utility
|
||||||
|
|
||||||
@@ -233,42 +233,42 @@ var Funcs = []string{
|
|||||||
|
|
||||||
// ---- io_writer
|
// ---- io_writer
|
||||||
|
|
||||||
"io_writer.write_u8?(x u8)",
|
"io_writer.write_u8?(a u8)",
|
||||||
"io_writer.write_u16be?(x u16)",
|
"io_writer.write_u16be?(a u16)",
|
||||||
"io_writer.write_u16le?(x u16)",
|
"io_writer.write_u16le?(a u16)",
|
||||||
"io_writer.write_u24be?(x u32[..0xFFFFFF])",
|
"io_writer.write_u24be?(a u32[..0xFFFFFF])",
|
||||||
"io_writer.write_u24le?(x u32[..0xFFFFFF])",
|
"io_writer.write_u24le?(a u32[..0xFFFFFF])",
|
||||||
"io_writer.write_u32be?(x u32)",
|
"io_writer.write_u32be?(a u32)",
|
||||||
"io_writer.write_u32le?(x u32)",
|
"io_writer.write_u32le?(a u32)",
|
||||||
"io_writer.write_u40be?(x u64[..0xFFFFFFFFFF])",
|
"io_writer.write_u40be?(a u64[..0xFFFFFFFFFF])",
|
||||||
"io_writer.write_u40le?(x u64[..0xFFFFFFFFFF])",
|
"io_writer.write_u40le?(a u64[..0xFFFFFFFFFF])",
|
||||||
"io_writer.write_u48be?(x u64[..0xFFFFFFFFFFFF])",
|
"io_writer.write_u48be?(a u64[..0xFFFFFFFFFFFF])",
|
||||||
"io_writer.write_u48le?(x u64[..0xFFFFFFFFFFFF])",
|
"io_writer.write_u48le?(a u64[..0xFFFFFFFFFFFF])",
|
||||||
"io_writer.write_u56be?(x u64[..0xFFFFFFFFFFFFFF])",
|
"io_writer.write_u56be?(a u64[..0xFFFFFFFFFFFFFF])",
|
||||||
"io_writer.write_u56le?(x u64[..0xFFFFFFFFFFFFFF])",
|
"io_writer.write_u56le?(a u64[..0xFFFFFFFFFFFFFF])",
|
||||||
"io_writer.write_u64be?(x u64)",
|
"io_writer.write_u64be?(a u64)",
|
||||||
"io_writer.write_u64le?(x u64)",
|
"io_writer.write_u64le?(a u64)",
|
||||||
|
|
||||||
// TODO: these should have an explicit pre-condition "available() >= N".
|
// TODO: these should have an explicit pre-condition "available() >= N".
|
||||||
// For now, that's implicitly checked (i.e. hard coded).
|
// For now, that's implicitly checked (i.e. hard coded).
|
||||||
//
|
//
|
||||||
// The io_writer has write_fast_etc methods, not poke_etc and skip_fast,
|
// 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.
|
// because skip_fast could leave uninitialized bytes in the io_buffer.
|
||||||
"io_writer.write_fast_u8!(x u8)",
|
"io_writer.write_fast_u8!(a u8)",
|
||||||
"io_writer.write_fast_u16be!(x u16)",
|
"io_writer.write_fast_u16be!(a u16)",
|
||||||
"io_writer.write_fast_u16le!(x u16)",
|
"io_writer.write_fast_u16le!(a u16)",
|
||||||
"io_writer.write_fast_u24be!(x u32[..0xFFFFFF])",
|
"io_writer.write_fast_u24be!(a u32[..0xFFFFFF])",
|
||||||
"io_writer.write_fast_u24le!(x u32[..0xFFFFFF])",
|
"io_writer.write_fast_u24le!(a u32[..0xFFFFFF])",
|
||||||
"io_writer.write_fast_u32be!(x u32)",
|
"io_writer.write_fast_u32be!(a u32)",
|
||||||
"io_writer.write_fast_u32le!(x u32)",
|
"io_writer.write_fast_u32le!(a u32)",
|
||||||
"io_writer.write_fast_u40be!(x u64[..0xFFFFFFFFFF])",
|
"io_writer.write_fast_u40be!(a u64[..0xFFFFFFFFFF])",
|
||||||
"io_writer.write_fast_u40le!(x u64[..0xFFFFFFFFFF])",
|
"io_writer.write_fast_u40le!(a u64[..0xFFFFFFFFFF])",
|
||||||
"io_writer.write_fast_u48be!(x u64[..0xFFFFFFFFFFFF])",
|
"io_writer.write_fast_u48be!(a u64[..0xFFFFFFFFFFFF])",
|
||||||
"io_writer.write_fast_u48le!(x u64[..0xFFFFFFFFFFFF])",
|
"io_writer.write_fast_u48le!(a u64[..0xFFFFFFFFFFFF])",
|
||||||
"io_writer.write_fast_u56be!(x u64[..0xFFFFFFFFFFFFFF])",
|
"io_writer.write_fast_u56be!(a u64[..0xFFFFFFFFFFFFFF])",
|
||||||
"io_writer.write_fast_u56le!(x u64[..0xFFFFFFFFFFFFFF])",
|
"io_writer.write_fast_u56le!(a u64[..0xFFFFFFFFFFFFFF])",
|
||||||
"io_writer.write_fast_u64be!(x u64)",
|
"io_writer.write_fast_u64be!(a u64)",
|
||||||
"io_writer.write_fast_u64le!(x u64)",
|
"io_writer.write_fast_u64le!(a u64)",
|
||||||
|
|
||||||
"io_writer.available() u64",
|
"io_writer.available() u64",
|
||||||
"io_writer.count_since(mark u64) u64",
|
"io_writer.count_since(mark u64) u64",
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
|
|||||||
|
|
||||||
if (table_entry >> 31) <> 0 {
|
if (table_entry >> 31) <> 0 {
|
||||||
// Literal.
|
// Literal.
|
||||||
args.dst.write_fast_u8!(x:((table_entry >> 8) & 0xFF) as base.u8)
|
args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||||
continue:loop
|
continue:loop
|
||||||
} else if (table_entry >> 30) <> 0 {
|
} else if (table_entry >> 30) <> 0 {
|
||||||
// No-op; code continues past the if-else chain.
|
// No-op; code continues past the if-else chain.
|
||||||
@@ -137,7 +137,7 @@ pri func decoder.decode_huffman_fast!(dst base.io_writer, src base.io_reader) ba
|
|||||||
|
|
||||||
if (table_entry >> 31) <> 0 {
|
if (table_entry >> 31) <> 0 {
|
||||||
// Literal.
|
// Literal.
|
||||||
args.dst.write_fast_u8!(x:((table_entry >> 8) & 0xFF) as base.u8)
|
args.dst.write_fast_u8!(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||||
continue:loop
|
continue:loop
|
||||||
} else if (table_entry >> 30) <> 0 {
|
} else if (table_entry >> 30) <> 0 {
|
||||||
// No-op; code continues past the if-else chain.
|
// No-op; code continues past the if-else chain.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
|||||||
|
|
||||||
if (table_entry >> 31) <> 0 {
|
if (table_entry >> 31) <> 0 {
|
||||||
// Literal.
|
// Literal.
|
||||||
args.dst.write_u8?(x:((table_entry >> 8) & 0xFF) as base.u8)
|
args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||||
continue:loop
|
continue:loop
|
||||||
} else if (table_entry >> 30) <> 0 {
|
} else if (table_entry >> 30) <> 0 {
|
||||||
// No-op; code continues past the if-else chain.
|
// No-op; code continues past the if-else chain.
|
||||||
@@ -94,7 +94,7 @@ pri func decoder.decode_huffman_slow?(dst base.io_writer, src base.io_reader) {
|
|||||||
|
|
||||||
if (table_entry >> 31) <> 0 {
|
if (table_entry >> 31) <> 0 {
|
||||||
// Literal.
|
// Literal.
|
||||||
args.dst.write_u8?(x:((table_entry >> 8) & 0xFF) as base.u8)
|
args.dst.write_u8?(a:((table_entry >> 8) & 0xFF) as base.u8)
|
||||||
continue:loop
|
continue:loop
|
||||||
} else if (table_entry >> 30) <> 0 {
|
} else if (table_entry >> 30) <> 0 {
|
||||||
// No-op; code continues past the if-else chain.
|
// No-op; code continues past the if-else chain.
|
||||||
|
|||||||
+13
-15
@@ -368,10 +368,8 @@ pub func decoder.num_decoded_frames() base.u64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
|
pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
|
||||||
// The "foo.min(x:this.width_or_height)" calls clip the nominal frame_rect
|
// The "foo.min(a:this.width_or_height)" calls clip the nominal frame_rect
|
||||||
// to the image_rect. The "x" argument name doesn't necessarily mean "the x
|
// to the image_rect.
|
||||||
// direction". It's just that, in Wuffs, every function call argument needs
|
|
||||||
// a name, and for the min function, "x" is as good a name as any other.
|
|
||||||
//
|
//
|
||||||
// TODO: explicitly intersect this with the frame_rect (in the y
|
// TODO: explicitly intersect this with the frame_rect (in the y
|
||||||
// direction)? In theory, that should be unnecessary, and could hide bugs,
|
// direction)? In theory, that should be unnecessary, and could hide bugs,
|
||||||
@@ -381,9 +379,9 @@ pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
|
|||||||
// Note that this method is pure, so it cannot set a sticky error bit if
|
// Note that this method is pure, so it cannot set a sticky error bit if
|
||||||
// the dirty_rect is too big.
|
// the dirty_rect is too big.
|
||||||
return this.util.make_rect_ie_u32(
|
return this.util.make_rect_ie_u32(
|
||||||
min_incl_x:this.frame_rect_x0.min(x:this.width),
|
min_incl_x:this.frame_rect_x0.min(a:this.width),
|
||||||
min_incl_y:this.dirty_y.get_min_incl(),
|
min_incl_y:this.dirty_y.get_min_incl(),
|
||||||
max_excl_x:this.frame_rect_x1.min(x:this.width),
|
max_excl_x:this.frame_rect_x1.min(a:this.width),
|
||||||
max_excl_y:this.dirty_y.get_max_excl())
|
max_excl_y:this.dirty_y.get_max_excl())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,10 +460,10 @@ pub func decoder.decode_frame_config?(dst nptr base.frame_config, src base.io_re
|
|||||||
// function call argument needs a name, and for the min function, "x"
|
// function call argument needs a name, and for the min function, "x"
|
||||||
// is as good a name as any other.
|
// is as good a name as any other.
|
||||||
args.dst.update!(bounds:this.util.make_rect_ie_u32(
|
args.dst.update!(bounds:this.util.make_rect_ie_u32(
|
||||||
min_incl_x:this.frame_rect_x0.min(x:this.width),
|
min_incl_x:this.frame_rect_x0.min(a:this.width),
|
||||||
min_incl_y:this.frame_rect_y0.min(x:this.height),
|
min_incl_y:this.frame_rect_y0.min(a:this.height),
|
||||||
max_excl_x:this.frame_rect_x1.min(x:this.width),
|
max_excl_x:this.frame_rect_x1.min(a:this.width),
|
||||||
max_excl_y:this.frame_rect_y1.min(x:this.height)),
|
max_excl_y:this.frame_rect_y1.min(a:this.height)),
|
||||||
duration:this.gc_duration,
|
duration:this.gc_duration,
|
||||||
index:this.num_decoded_frame_configs_value,
|
index:this.num_decoded_frame_configs_value,
|
||||||
io_position:this.frame_config_io_position,
|
io_position:this.frame_config_io_position,
|
||||||
@@ -892,8 +890,8 @@ pri func decoder.decode_id_part0?(src base.io_reader) {
|
|||||||
// test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt for
|
// test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt for
|
||||||
// more discussion.
|
// more discussion.
|
||||||
if (this.call_sequence == 0) and (not this.quirk_enabled_image_bounds_are_strict) {
|
if (this.call_sequence == 0) and (not this.quirk_enabled_image_bounds_are_strict) {
|
||||||
this.width = this.width.max(x:this.frame_rect_x1)
|
this.width = this.width.max(a:this.frame_rect_x1)
|
||||||
this.height = this.height.max(x:this.frame_rect_y1)
|
this.height = this.height.max(a:this.frame_rect_y1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1031,7 +1029,7 @@ pri func decoder.decode_id_part2?(dst ptr base.pixel_buffer, src base.io_reader,
|
|||||||
this.compressed_wi = 0
|
this.compressed_wi = 0
|
||||||
}
|
}
|
||||||
while this.compressed_wi <= (4096 - 255) {
|
while this.compressed_wi <= (4096 - 255) {
|
||||||
n_compressed = block_size.min(x:args.src.available())
|
n_compressed = block_size.min(a:args.src.available())
|
||||||
if n_compressed <= 0 {
|
if n_compressed <= 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -1192,7 +1190,7 @@ pri func decoder.copy_to_image_buffer!(pb ptr base.pixel_buffer, src slice base.
|
|||||||
|
|
||||||
replicate_count = (interlace_count[this.interlace] as base.u32) + 1
|
replicate_count = (interlace_count[this.interlace] as base.u32) + 1
|
||||||
replicate_count = replicate_count ~sat+ this.dst_y
|
replicate_count = replicate_count ~sat+ this.dst_y
|
||||||
replicate_count = replicate_count.min(x:this.frame_rect_y1)
|
replicate_count = replicate_count.min(a:this.frame_rect_y1)
|
||||||
this.dirty_y = this.dirty_y.unite(r:this.util.make_range_ie_u32(
|
this.dirty_y = this.dirty_y.unite(r:this.util.make_range_ie_u32(
|
||||||
min_incl:this.dst_y,
|
min_incl:this.dst_y,
|
||||||
max_excl:replicate_count))
|
max_excl:replicate_count))
|
||||||
@@ -1217,7 +1215,7 @@ pri func decoder.copy_to_image_buffer!(pb ptr base.pixel_buffer, src slice base.
|
|||||||
|
|
||||||
// Set n to the number of pixels (i.e. the number of bytes) to skip.
|
// Set n to the number of pixels (i.e. the number of bytes) to skip.
|
||||||
n = (this.frame_rect_x1 - this.dst_x) as base.u64
|
n = (this.frame_rect_x1 - this.dst_x) as base.u64
|
||||||
n = n.min(x:args.src.length() - src_ri)
|
n = n.min(a:args.src.length() - src_ri)
|
||||||
|
|
||||||
src_ri ~sat+= n
|
src_ri ~sat+= n
|
||||||
this.dst_x ~sat+= (n & 0xFFFFFFFF) as base.u32
|
this.dst_x ~sat+= (n & 0xFFFFFFFF) as base.u32
|
||||||
|
|||||||
Reference in new issue
Block a user