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 {...@@ -974,7 +974,7 @@ fn hexDump(out: anytype, bytes: []const u8) !void {
974 var line: usize = 0;974 var line: usize = 0;
975 var offset: usize = 0;975 var offset: usize = 0;
976 while (line < n16) : (line += 1) {976 while (line < n16) : (line += 1) {
977 try hexDump16(out, offset, bytes[offset .. offset + 16]);977 try hexDump16(out, offset, bytes[offset..][0..16]);
978 offset += 16;978 offset += 16;
979 }979 }
980980
lib/std/array_list.zig+2-2
...@@ -173,7 +173,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {...@@ -173,7 +173,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
173 @memcpy(self.items[i..][0..items.len], items);173 @memcpy(self.items[i..][0..items.len], items);
174 }174 }
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`.
177 /// Grows list if `len < new_items.len`.177 /// Grows list if `len < new_items.len`.
178 /// Shrinks list if `len > new_items.len`.178 /// Shrinks list if `len > new_items.len`.
179 /// Invalidates pointers if this ArrayList is resized.179 /// Invalidates pointers if this ArrayList is resized.
...@@ -654,7 +654,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ...@@ -654,7 +654,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
654 @memcpy(self.items[i..][0..items.len], items);654 @memcpy(self.items[i..][0..items.len], items);
655 }655 }
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`
658 /// Grows list if `len < new_items.len`.658 /// Grows list if `len < new_items.len`.
659 /// Shrinks list if `len > new_items.len`659 /// Shrinks list if `len > new_items.len`
660 /// Invalidates pointers if this ArrayList is resized.660 /// Invalidates pointers if this ArrayList is resized.
lib/std/bounded_array.zig+1-1
...@@ -168,7 +168,7 @@ pub fn BoundedArrayAligned(...@@ -168,7 +168,7 @@ pub fn BoundedArrayAligned(
168 @memcpy(self.slice()[i..][0..items.len], items);168 @memcpy(self.slice()[i..][0..items.len], items);
169 }169 }
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`.
172 /// Grows slice if `len < new_items.len`.172 /// Grows slice if `len < new_items.len`.
173 /// Shrinks slice if `len > new_items.len`.173 /// Shrinks slice if `len > new_items.len`.
174 pub fn replaceRange(174 pub fn replaceRange(
lib/std/compress/deflate/decompressor.zig+1-1
...@@ -591,7 +591,7 @@ pub fn Decompressor(comptime ReaderType: type) type {...@@ -591,7 +591,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
591 }591 }
592592
593 if (!try self.hd1.init(self.allocator, self.bits[0..nlit]) or593 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]))
595 {595 {
596 corrupt_input_error_offset = self.roffset;596 corrupt_input_error_offset = self.roffset;
597 self.err = InflateError.CorruptInput;597 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 {...@@ -139,7 +139,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
139 self.bits >>= 48;139 self.bits >>= 48;
140 self.nbits -= 48;140 self.nbits -= 48;
141 var n = self.nbytes;141 var n = self.nbytes;
142 var bytes = self.bytes[n .. n + 6];142 var bytes = self.bytes[n..][0..6];
143 bytes[0] = @truncate(u8, bits);143 bytes[0] = @truncate(u8, bits);
144 bytes[1] = @truncate(u8, bits >> 8);144 bytes[1] = @truncate(u8, bits >> 8);
145 bytes[2] = @truncate(u8, bits >> 16);145 bytes[2] = @truncate(u8, bits >> 16);
...@@ -344,7 +344,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {...@@ -344,7 +344,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
344 self.bits >>= 48;344 self.bits >>= 48;
345 self.nbits -= 48;345 self.nbits -= 48;
346 var n = self.nbytes;346 var n = self.nbytes;
347 var bytes = self.bytes[n .. n + 6];347 var bytes = self.bytes[n..][0..6];
348 bytes[0] = @truncate(u8, bits);348 bytes[0] = @truncate(u8, bits);
349 bytes[1] = @truncate(u8, bits >> 8);349 bytes[1] = @truncate(u8, bits >> 8);
350 bytes[2] = @truncate(u8, bits >> 16);350 bytes[2] = @truncate(u8, bits >> 16);
...@@ -751,7 +751,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {...@@ -751,7 +751,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type {
751 var bits = self.bits;751 var bits = self.bits;
752 self.bits >>= 48;752 self.bits >>= 48;
753 self.nbits -= 48;753 self.nbits -= 48;
754 var bytes = self.bytes[n .. n + 6];754 var bytes = self.bytes[n..][0..6];
755 bytes[0] = @truncate(u8, bits);755 bytes[0] = @truncate(u8, bits);
756 bytes[1] = @truncate(u8, bits >> 8);756 bytes[1] = @truncate(u8, bits >> 8);
757 bytes[2] = @truncate(u8, bits >> 16);757 bytes[2] = @truncate(u8, bits >> 16);
lib/std/hash/crc.zig+1-1
...@@ -160,7 +160,7 @@ pub fn Crc32WithPoly(comptime poly: Polynomial) type {...@@ -160,7 +160,7 @@ pub fn Crc32WithPoly(comptime poly: Polynomial) type {
160 pub fn update(self: *Self, input: []const u8) void {160 pub fn update(self: *Self, input: []const u8) void {
161 var i: usize = 0;161 var i: usize = 0;
162 while (i + 8 <= input.len) : (i += 8) {162 while (i + 8 <= input.len) : (i += 8) {
163 const p = input[i .. i + 8];163 const p = input[i..][0..8];
164164
165 // Unrolling this way gives ~50Mb/s increase165 // Unrolling this way gives ~50Mb/s increase
166 self.crc ^= std.mem.readIntLittle(u32, p[0..4]);166 self.crc ^= std.mem.readIntLittle(u32, p[0..4]);
lib/std/hash/wyhash.zig+1-1
...@@ -65,7 +65,7 @@ const WyhashStateless = struct {...@@ -65,7 +65,7 @@ const WyhashStateless = struct {
6565
66 var off: usize = 0;66 var off: usize = 0;
67 while (off < b.len) : (off += 32) {67 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]});
69 }69 }
7070
71 self.msg_len += b.len;71 self.msg_len += b.len;
lib/std/json.zig+3-3
...@@ -63,7 +63,7 @@ fn encodesTo(decoded: []const u8, encoded: []const u8) bool {...@@ -63,7 +63,7 @@ fn encodesTo(decoded: []const u8, encoded: []const u8) bool {
63 var buf: [4]u8 = undefined;63 var buf: [4]u8 = undefined;
64 const len = std.unicode.utf8Encode(codepoint, &buf) catch unreachable;64 const len = std.unicode.utf8Encode(codepoint, &buf) catch unreachable;
65 if (i + len > decoded.len) return false;65 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;
67 i += len;67 i += len;
68 }68 }
69 }69 }
...@@ -2285,10 +2285,10 @@ pub fn encodeJsonStringChars(chars: []const u8, options: StringifyOptions, write...@@ -2285,10 +2285,10 @@ pub fn encodeJsonStringChars(chars: []const u8, options: StringifyOptions, write
2285 const ulen = std.unicode.utf8ByteSequenceLength(chars[i]) catch unreachable;2285 const ulen = std.unicode.utf8ByteSequenceLength(chars[i]) catch unreachable;
2286 // control characters (only things left with 1 byte length) should always be printed as unicode escapes2286 // control characters (only things left with 1 byte length) should always be printed as unicode escapes
2287 if (ulen == 1 or options.string.String.escape_unicode) {2287 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;
2289 try outputUnicodeEscape(codepoint, writer);2289 try outputUnicodeEscape(codepoint, writer);
2290 } else {2290 } else {
2291 try writer.writeAll(chars[i .. i + ulen]);2291 try writer.writeAll(chars[i..][0..ulen]);
2292 }2292 }
2293 i += ulen - 1;2293 i += ulen - 1;
2294 },2294 },
lib/std/math/big/int.zig+1-1
...@@ -4035,7 +4035,7 @@ fn llsquareBasecase(r: []Limb, x: []const Limb) void {...@@ -4035,7 +4035,7 @@ fn llsquareBasecase(r: []Limb, x: []const Limb) void {
40354035
4036 for (x_norm, 0..) |v, i| {4036 for (x_norm, 0..) |v, i| {
4037 // Compute and add the squares4037 // 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);
4039 assert(!overflow);4039 assert(!overflow);
4040 }4040 }
4041}4041}
lib/std/net.zig+1-1
...@@ -1701,7 +1701,7 @@ fn dnsParse(...@@ -1701,7 +1701,7 @@ fn dnsParse(
1701 p += @as(usize, 1) + @boolToInt(p[0] != 0);1701 p += @as(usize, 1) + @boolToInt(p[0] != 0);
1702 const len = p[8] * @as(usize, 256) + p[9];1702 const len = p[8] * @as(usize, 256) + p[9];
1703 if (@ptrToInt(p) + len > @ptrToInt(r.ptr) + r.len) return error.InvalidDnsPacket;1703 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);
1705 p += 10 + len;1705 p += 10 + len;
1706 }1706 }
1707}1707}
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...@@ -835,14 +835,14 @@ pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLin
835 const len = buf.SubstituteNameLength >> 1;835 const len = buf.SubstituteNameLength >> 1;
836 const path_buf = @as([*]const u16, &buf.PathBuffer);836 const path_buf = @as([*]const u16, &buf.PathBuffer);
837 const is_relative = buf.Flags & SYMLINK_FLAG_RELATIVE != 0;837 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);
839 },839 },
840 IO_REPARSE_TAG_MOUNT_POINT => {840 IO_REPARSE_TAG_MOUNT_POINT => {
841 const buf = @ptrCast(*const MOUNT_POINT_REPARSE_BUFFER, @alignCast(@alignOf(MOUNT_POINT_REPARSE_BUFFER), &reparse_struct.DataBuffer[0]));841 const buf = @ptrCast(*const MOUNT_POINT_REPARSE_BUFFER, @alignCast(@alignOf(MOUNT_POINT_REPARSE_BUFFER), &reparse_struct.DataBuffer[0]));
842 const offset = buf.SubstituteNameOffset >> 1;842 const offset = buf.SubstituteNameOffset >> 1;
843 const len = buf.SubstituteNameLength >> 1;843 const len = buf.SubstituteNameLength >> 1;
844 const path_buf = @as([*]const u16, &buf.PathBuffer);844 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);
846 },846 },
847 else => |value| {847 else => |value| {
848 std.debug.print("unsupported symlink type: {}", .{value});848 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 {...@@ -941,7 +941,7 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void {
941fn printWithVisibleNewlines(source: []const u8) void {941fn printWithVisibleNewlines(source: []const u8) void {
942 var i: usize = 0;942 var i: usize = 0;
943 while (std.mem.indexOfScalar(u8, source[i..], '\n')) |nl| : (i += nl + 1) {943 while (std.mem.indexOfScalar(u8, source[i..], '\n')) |nl| : (i += nl + 1) {
944 printLine(source[i .. i + nl]);944 printLine(source[i..][0..nl]);
945 }945 }
946 print("{s}␃\n", .{source[i..]}); // End of Text symbol (ETX)946 print("{s}␃\n", .{source[i..]}); // End of Text symbol (ETX)
947}947}
lib/std/unicode.zig+1-1
...@@ -185,7 +185,7 @@ pub fn utf8CountCodepoints(s: []const u8) !usize {...@@ -185,7 +185,7 @@ pub fn utf8CountCodepoints(s: []const u8) !usize {
185185
186 switch (n) {186 switch (n) {
187 1 => {}, // ASCII, no validation needed187 1 => {}, // ASCII, no validation needed
188 else => _ = try utf8Decode(s[i .. i + n]),188 else => _ = try utf8Decode(s[i..][0..n]),
189 }189 }
190190
191 i += n;191 i += n;
src/link/Plan9/aout.zig+1-1
...@@ -21,7 +21,7 @@ pub const ExecHdr = extern struct {...@@ -21,7 +21,7 @@ pub const ExecHdr = extern struct {
21 var buf: [40]u8 = undefined;21 var buf: [40]u8 = undefined;
22 var i: u8 = 0;22 var i: u8 = 0;
23 inline for (std.meta.fields(@This())) |f| {23 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));
25 i += 4;25 i += 4;
26 }26 }
27 return buf;27 return buf;