authorgravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2023-05-02 22:08:54+10:00
committergravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2023-05-07 15:55:21+10:00
logbd3360e03d89fe947e3728ccacd4274653926376
treedaf2107f394c94b41c55a6ecacd9f82ba145c1c4
parent2c5924c59a148335e5025b72a5ba98d765ed771d

convert s[start..start+len] to s[start..][0..len]


14 files changed, 20 insertions(+), 20 deletions(-)

lib/std/Build/Cache/DepTokenizer.zig+1-1
......@@ -974,7 +974,7 @@ fn hexDump(out: anytype, bytes: []const u8) !void {
974974 var line: usize = 0;
975975 var offset: usize = 0;
976976 while (line < n16) : (line += 1) {
977 try hexDump16(out, offset, bytes[offset .. offset + 16]);
977 try hexDump16(out, offset, bytes[offset..][0..16]);
978978 offset += 16;
979979 }
980980
lib/std/array_list.zig+2-2
......@@ -173,7 +173,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
173173 @memcpy(self.items[i..][0..items.len], items);
174174 }
175175
176 /// Replace range of elements `list[start..start+len]` with `new_items`.
176 /// Replace range of elements `list[start..][0..len]` with `new_items`.
177177 /// Grows list if `len < new_items.len`.
178178 /// Shrinks list if `len > new_items.len`.
179179 /// Invalidates pointers if this ArrayList is resized.
......@@ -654,7 +654,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
654654 @memcpy(self.items[i..][0..items.len], items);
655655 }
656656
657 /// Replace range of elements `list[start..start+len]` with `new_items`
657 /// Replace range of elements `list[start..][0..len]` with `new_items`
658658 /// Grows list if `len < new_items.len`.
659659 /// Shrinks list if `len > new_items.len`
660660 /// Invalidates pointers if this ArrayList is resized.
lib/std/bounded_array.zig+1-1
......@@ -168,7 +168,7 @@ pub fn BoundedArrayAligned(
168168 @memcpy(self.slice()[i..][0..items.len], items);
169169 }
170170
171 /// Replace range of elements `slice[start..start+len]` with `new_items`.
171 /// Replace range of elements `slice[start..][0..len]` with `new_items`.
172172 /// Grows slice if `len < new_items.len`.
173173 /// Shrinks slice if `len > new_items.len`.
174174 pub fn replaceRange(
lib/std/compress/deflate/decompressor.zig+1-1
......@@ -591,7 +591,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
591591 }
592592
593593 if (!try self.hd1.init(self.allocator, self.bits[0..nlit]) or
594 !try self.hd2.init(self.allocator, self.bits[nlit .. nlit + ndist]))
594 !try self.hd2.init(self.allocator, self.bits[nlit..][0..ndist]))
595595 {
596596 corrupt_input_error_offset = self.roffset;
597597 self.err = InflateError.CorruptInput;
lib/std/compress/deflate/huffman_bit_writer.zig+3-3
......@@ -139,7 +139,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
139139 self.bits >>= 48;
140140 self.nbits -= 48;
141141 var n = self.nbytes;
142 var bytes = self.bytes[n .. n + 6];
142 var bytes = self.bytes[n..][0..6];
143143 bytes[0] = @truncate(u8, bits);
144144 bytes[1] = @truncate(u8, bits >> 8);
145145 bytes[2] = @truncate(u8, bits >> 16);
......@@ -344,7 +344,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
344344 self.bits >>= 48;
345345 self.nbits -= 48;
346346 var n = self.nbytes;
347 var bytes = self.bytes[n .. n + 6];
347 var bytes = self.bytes[n..][0..6];
348348 bytes[0] = @truncate(u8, bits);
349349 bytes[1] = @truncate(u8, bits >> 8);
350350 bytes[2] = @truncate(u8, bits >> 16);
......@@ -751,7 +751,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
751751 var bits = self.bits;
752752 self.bits >>= 48;
753753 self.nbits -= 48;
754 var bytes = self.bytes[n .. n + 6];
754 var bytes = self.bytes[n..][0..6];
755755 bytes[0] = @truncate(u8, bits);
756756 bytes[1] = @truncate(u8, bits >> 8);
757757 bytes[2] = @truncate(u8, bits >> 16);
lib/std/hash/crc.zig+1-1
......@@ -160,7 +160,7 @@ pub fn Crc32WithPoly(comptime poly: Polynomial) type {
160160 pub fn update(self: *Self, input: []const u8) void {
161161 var i: usize = 0;
162162 while (i + 8 <= input.len) : (i += 8) {
163 const p = input[i .. i + 8];
163 const p = input[i..][0..8];
164164
165165 // Unrolling this way gives ~50Mb/s increase
166166 self.crc ^= std.mem.readIntLittle(u32, p[0..4]);
lib/std/hash/wyhash.zig+1-1
......@@ -65,7 +65,7 @@ const WyhashStateless = struct {
6565
6666 var off: usize = 0;
6767 while (off < b.len) : (off += 32) {
68 @call(.always_inline, self.round, .{b[off .. off + 32]});
68 @call(.always_inline, self.round, .{b[off..][0..32]});
6969 }
7070
7171 self.msg_len += b.len;
lib/std/json.zig+3-3
......@@ -63,7 +63,7 @@ fn encodesTo(decoded: []const u8, encoded: []const u8) bool {
6363 var buf: [4]u8 = undefined;
6464 const len = std.unicode.utf8Encode(codepoint, &buf) catch unreachable;
6565 if (i + len > decoded.len) return false;
66 if (!mem.eql(u8, decoded[i .. i + len], buf[0..len])) return false;
66 if (!mem.eql(u8, decoded[i..][0..len], buf[0..len])) return false;
6767 i += len;
6868 }
6969 }
......@@ -2285,10 +2285,10 @@ pub fn encodeJsonStringChars(chars: []const u8, options: StringifyOptions, write
22852285 const ulen = std.unicode.utf8ByteSequenceLength(chars[i]) catch unreachable;
22862286 // control characters (only things left with 1 byte length) should always be printed as unicode escapes
22872287 if (ulen == 1 or options.string.String.escape_unicode) {
2288 const codepoint = std.unicode.utf8Decode(chars[i .. i + ulen]) catch unreachable;
2288 const codepoint = std.unicode.utf8Decode(chars[i..][0..ulen]) catch unreachable;
22892289 try outputUnicodeEscape(codepoint, writer);
22902290 } else {
2291 try writer.writeAll(chars[i .. i + ulen]);
2291 try writer.writeAll(chars[i..][0..ulen]);
22922292 }
22932293 i += ulen - 1;
22942294 },
lib/std/math/big/int.zig+1-1
......@@ -4035,7 +4035,7 @@ fn llsquareBasecase(r: []Limb, x: []const Limb) void {
40354035
40364036 for (x_norm, 0..) |v, i| {
40374037 // Compute and add the squares
4038 const overflow = llmulLimb(.add, r[2 * i ..], x[i .. i + 1], v);
4038 const overflow = llmulLimb(.add, r[2 * i ..], x[i..][0..1], v);
40394039 assert(!overflow);
40404040 }
40414041}
lib/std/net.zig+1-1
......@@ -1701,7 +1701,7 @@ fn dnsParse(
17011701 p += @as(usize, 1) + @boolToInt(p[0] != 0);
17021702 const len = p[8] * @as(usize, 256) + p[9];
17031703 if (@ptrToInt(p) + len > @ptrToInt(r.ptr) + r.len) return error.InvalidDnsPacket;
1704 try callback(ctx, p[1], p[10 .. 10 + len], r);
1704 try callback(ctx, p[1], p[10..][0..len], r);
17051705 p += 10 + len;
17061706 }
17071707}
lib/std/os/windows.zig+2-2
......@@ -835,14 +835,14 @@ pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLin
835835 const len = buf.SubstituteNameLength >> 1;
836836 const path_buf = @as([*]const u16, &buf.PathBuffer);
837837 const is_relative = buf.Flags & SYMLINK_FLAG_RELATIVE != 0;
838 return parseReadlinkPath(path_buf[offset .. offset + len], is_relative, out_buffer);
838 return parseReadlinkPath(path_buf[offset..][0..len], is_relative, out_buffer);
839839 },
840840 IO_REPARSE_TAG_MOUNT_POINT => {
841841 const buf = @ptrCast(*const MOUNT_POINT_REPARSE_BUFFER, @alignCast(@alignOf(MOUNT_POINT_REPARSE_BUFFER), &reparse_struct.DataBuffer[0]));
842842 const offset = buf.SubstituteNameOffset >> 1;
843843 const len = buf.SubstituteNameLength >> 1;
844844 const path_buf = @as([*]const u16, &buf.PathBuffer);
845 return parseReadlinkPath(path_buf[offset .. offset + len], false, out_buffer);
845 return parseReadlinkPath(path_buf[offset..][0..len], false, out_buffer);
846846 },
847847 else => |value| {
848848 std.debug.print("unsupported symlink type: {}", .{value});
lib/std/testing.zig+1-1
......@@ -941,7 +941,7 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void {
941941fn printWithVisibleNewlines(source: []const u8) void {
942942 var i: usize = 0;
943943 while (std.mem.indexOfScalar(u8, source[i..], '\n')) |nl| : (i += nl + 1) {
944 printLine(source[i .. i + nl]);
944 printLine(source[i..][0..nl]);
945945 }
946946 print("{s}␃\n", .{source[i..]}); // End of Text symbol (ETX)
947947}
lib/std/unicode.zig+1-1
......@@ -185,7 +185,7 @@ pub fn utf8CountCodepoints(s: []const u8) !usize {
185185
186186 switch (n) {
187187 1 => {}, // ASCII, no validation needed
188 else => _ = try utf8Decode(s[i .. i + n]),
188 else => _ = try utf8Decode(s[i..][0..n]),
189189 }
190190
191191 i += n;
src/link/Plan9/aout.zig+1-1
......@@ -21,7 +21,7 @@ pub const ExecHdr = extern struct {
2121 var buf: [40]u8 = undefined;
2222 var i: u8 = 0;
2323 inline for (std.meta.fields(@This())) |f| {
24 std.mem.writeIntSliceBig(u32, buf[i .. i + 4], @field(self, f.name));
24 std.mem.writeIntSliceBig(u32, buf[i..][0..4], @field(self, f.name));
2525 i += 4;
2626 }
2727 return buf;