diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index e10ffa01..fb9f5a9d 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -268,8 +268,7 @@ const ( ) var SliceFuncs = []string{ - // TODO: should copy_from_slice be a ! method? - "T1.copy_from_slice(s T1) u64", + "T1.copy_from_slice!(s T1) u64", "T1.length() u64", "T1.prefix(up_to u64) T1", "T1.suffix(up_to u64) T1", diff --git a/std/deflate/decode_deflate.wuffs b/std/deflate/decode_deflate.wuffs index 31ed2c50..f5d2a403 100644 --- a/std/deflate/decode_deflate.wuffs +++ b/std/deflate/decode_deflate.wuffs @@ -138,12 +138,12 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) { // previous value of history_index, as we will overwrite the whole // ringbuffer. written = written.suffix(up_to:0x8000) - this.history[:].copy_from_slice(s:written) + this.history[:].copy_from_slice!(s:written) this.history_index = 0x8000 } else { // Otherwise, append written to the history ringbuffer starting at // the previous history_index (modulo 0x8000). - var n_copied base.u64 = this.history[this.history_index & 0x7FFF:].copy_from_slice(s:written) + var n_copied base.u64 = this.history[this.history_index & 0x7FFF:].copy_from_slice!(s:written) if n_copied < written.length() { // a_slice.copy_from(s:b_slice) returns the minimum of the two // slice lengths. If that value is less than b_slice.length(), @@ -153,7 +153,7 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) { // to wrap around and copy the remainder of written over the // start of the history ringbuffer. written = written[n_copied:] - n_copied = this.history[:].copy_from_slice(s:written) + n_copied = this.history[:].copy_from_slice!(s:written) // Set history_index (modulo 0x8000) to the length of this // remainder. The &0x7FFF is redundant, but proves to the // compiler that the conversion to u32 will not overflow. The diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index 331f6ada..5ed30e30 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -547,7 +547,7 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade i += 1 } } else if this.gc_has_transparent_index { - this.palettes[1][:].copy_from_slice(s:this.palettes[0][:]) + this.palettes[1][:].copy_from_slice!(s:this.palettes[0][:]) } else { this.which_palette = 0 } @@ -560,7 +560,7 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade this.palettes[1][(4 * (this.gc_transparent_index as base.u32)) + 3] = 0x00 } - args.dst.palette().copy_from_slice(s:this.palettes[this.which_palette][:]) + args.dst.palette().copy_from_slice!(s:this.palettes[this.which_palette][:]) // Other GIF implementations accept GIF files that aren't completely spec // compliant. For example, the test/data/gifplayer-muybridge.gif file @@ -666,7 +666,7 @@ pri func decoder.copy_to_image_buffer!??(pb ptr base.pixel_buffer) { } else { dst = dst[this.dst_x as base.u64:] } - n = (dst.copy_from_slice(s:src) & 0xFFFFFFFF) as base.u32 + n = (dst.copy_from_slice!(s:src) & 0xFFFFFFFF) as base.u32 new_ri = this.uncompressed_ri ~sat+ n this.uncompressed_ri = new_ri.min(x:4096)