diff --git a/lib/compiler/aro/aro/Preprocessor.zig b/lib/compiler/aro/aro/Preprocessor.zig index 15ac3b0a1bf4ccc4e3eb8e437c35c1d8985a837b..6b52492e7d9a09a1650c7ffdf27cd6ffd09cdad4 100644 --- a/lib/compiler/aro/aro/Preprocessor.zig +++ b/lib/compiler/aro/aro/Preprocessor.zig @@ -45,11 +45,11 @@ const IfContext = struct { level: u8, fn get(self: *const IfContext) Nesting { - return @enumFromInt(std.mem.readPackedIntNative(Backing, &self.kind, @as(usize, self.level) * 2)); + return @enumFromInt(std.mem.readPackedInt(Backing, &self.kind, @as(usize, self.level) * 2, .native)); } fn set(self: *IfContext, context: Nesting) void { - std.mem.writePackedIntNative(Backing, &self.kind, @as(usize, self.level) * 2, @intFromEnum(context)); + std.mem.writePackedInt(Backing, &self.kind, @as(usize, self.level) * 2, @intFromEnum(context), .native); } fn increment(self: *IfContext) bool { diff --git a/lib/compiler/aro/backend/Ir/x86/Renderer.zig b/lib/compiler/aro/backend/Ir/x86/Renderer.zig index 0726e638566074a0abadb726a3cecc9b2cac8309..f1793804be299d0e2f4c843bac0b1f0a24aa818b 100644 --- a/lib/compiler/aro/backend/Ir/x86/Renderer.zig +++ b/lib/compiler/aro/backend/Ir/x86/Renderer.zig @@ -21,17 +21,17 @@ const RegisterManager = zig.RegisterManager(Renderer, Register, Ir.Ref, abi.allo const RegisterBitSet = RegisterManager.RegisterBitSet; const RegisterClass = struct { const gp: RegisterBitSet = blk: { - var set = RegisterBitSet.initEmpty(); + var set: RegisterBitSet = .empty; for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .general_purpose) set.set(index); break :blk set; }; const x87: RegisterBitSet = blk: { - var set = RegisterBitSet.initEmpty(); + var set: RegisterBitSet = .empty; for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .x87) set.set(index); break :blk set; }; const sse: RegisterBitSet = blk: { - var set = RegisterBitSet.initEmpty(); + var set: RegisterBitSet = .empty; for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .sse) set.set(index); break :blk set; }; diff --git a/lib/compiler_rt/float_from_int.zig b/lib/compiler_rt/float_from_int.zig index 2fddcaea9505ce31fb7bb4a0c0299b4f00590b8c..d275e181799b4de5ef87a12933beca8e355af935 100644 --- a/lib/compiler_rt/float_from_int.zig +++ b/lib/compiler_rt/float_from_int.zig @@ -97,7 +97,7 @@ pub inline fn floatFromBigInt(comptime T: type, comptime signedness: std.builtin if (limb(x, limb_index) != 0) break true; } else limb(x, exponent_limb) & ((@as(u32, 1) << @truncate(exponent)) - 1) != 0; return math.ldexp(@as(T, @floatFromInt( - std.mem.readPackedIntNative(I, std.mem.sliceAsBytes(x), exponent) | @intFromBool(sticky), + std.mem.readPackedInt(I, std.mem.sliceAsBytes(x), exponent, .native) | @intFromBool(sticky), )), @intCast(exponent)); } diff --git a/lib/compiler_rt/int_from_float.zig b/lib/compiler_rt/int_from_float.zig index 146456fd110812e036413fc4638412d73cd0ac87..494ac6cdc392001e356f713bee733c73b19069e1 100644 --- a/lib/compiler_rt/int_from_float.zig +++ b/lib/compiler_rt/int_from_float.zig @@ -141,7 +141,7 @@ pub inline fn bigIntFromFloat(comptime signedness: std.builtin.Signedness, resul }, .unsigned => @memset(result, 0), } - std.mem.writePackedIntNative(I, std.mem.sliceAsBytes(result), exponent, int); + std.mem.writePackedInt(I, std.mem.sliceAsBytes(result), exponent, int, .native); } test { diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 037fce335064106b7b8051b94d3380e3138f54d5..5a76e773fa7f0ce04d13a91eda0e654d0f0aaa10 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -14401,7 +14401,7 @@ pub fn setTimestampToPosix(set_ts: File.SetTimestamp) posix.timespec { } pub fn pathToPosix(file_path: []const u8, buffer: *[posix.PATH_MAX]u8) Dir.PathNameError![:0]u8 { - if (std.mem.containsAtLeastScalar2(u8, file_path, 0, 1)) return error.BadPathName; + if (std.mem.containsAtLeastScalar(u8, file_path, 0, 1)) return error.BadPathName; // >= rather than > to make room for the null byte if (file_path.len >= buffer.len) return error.NameTooLong; @memcpy(buffer[0..file_path.len], file_path); diff --git a/lib/std/ascii.zig b/lib/std/ascii.zig index 5a9248f2f57d4f60c86184558b8084b50c1e0b5d..e346e87eb6805c0328d909a1709223c628db5858 100644 --- a/lib/std/ascii.zig +++ b/lib/std/ascii.zig @@ -378,17 +378,11 @@ test endsWithIgnoreCase { try std.testing.expect(!endsWithIgnoreCase("BoB", "Bo")); } -/// Deprecated in favor of `findIgnoreCase`. -pub const indexOfIgnoreCase = findIgnoreCase; - /// Finds `needle` in `haystack`, ignoring case, starting at index 0. pub fn findIgnoreCase(haystack: []const u8, needle: []const u8) ?usize { return findIgnoreCasePos(haystack, 0, needle); } -/// Deprecated in favor of `findIgnoreCasePos`. -pub const indexOfIgnoreCasePos = findIgnoreCasePos; - /// Finds `needle` in `haystack`, ignoring case, starting at `start_index`. /// Uses Boyer-Moore-Horspool algorithm on large inputs; `findIgnoreCasePosLinear` on small inputs. pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []const u8) ?usize { @@ -410,9 +404,6 @@ pub fn findIgnoreCasePos(haystack: []const u8, start_index: usize, needle: []con return null; } -/// Deprecated in favor of `findIgnoreCaseLinear`. -pub const indexOfIgnoreCasePosLinear = findIgnoreCasePosLinear; - /// Consider using `findIgnoreCasePos` instead of this, which will automatically use a /// more sophisticated algorithm on larger inputs. pub fn findIgnoreCasePosLinear(haystack: []const u8, start_index: usize, needle: []const u8) ?usize { diff --git a/lib/std/bit_set.zig b/lib/std/bit_set.zig index a0388cd82b4dad52699b4aca320d669ae9c5b8b8..ad4bb5317aad825d62e1250f143370fd2dbf2fea 100644 --- a/lib/std/bit_set.zig +++ b/lib/std/bit_set.zig @@ -73,18 +73,6 @@ pub fn Integer(comptime size: u16) type { /// The bit mask, as a single integer mask: MaskInt, - /// Deprecated: use `.empty`. - /// Creates a bit set with no elements present. - pub fn initEmpty() Self { - return .{ .mask = 0 }; - } - - /// Deprecated: use `.full`. - /// Creates a bit set with all elements present. - pub fn initFull() Self { - return .{ .mask = ~@as(MaskInt, 0) }; - } - /// A bit set with no elements present. pub const empty: Self = .{ .mask = 0 }; @@ -403,18 +391,6 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type { /// Padding bits at the end are undefined. masks: [num_masks]MaskInt, - /// Deprecated: use `.empty`. - /// Creates a bit set with no elements present. - pub fn initEmpty() Self { - return .empty; - } - - /// Deprecated: use `.full`. - /// Creates a bit set with all elements present. - pub fn initFull() Self { - return .full; - } - /// A bit set with no elements present. pub const empty: Self = .{ .masks = @splat(0) }; diff --git a/lib/std/enums.zig b/lib/std/enums.zig index 3e097c25053278c2bcf77bffd7e06ddc9b5adcad..fbd1f9111e67ad01b463f626c502404eca297f4a 100644 --- a/lib/std/enums.zig +++ b/lib/std/enums.zig @@ -284,18 +284,6 @@ pub fn EnumSet(comptime E: type) type { /// A set containing all possible keys. pub const full: Self = .{ .bits = .full }; - /// Deprecated: use `.empty`. - /// Returns a set containing no keys. - pub fn initEmpty() Self { - return .empty; - } - - /// Deprecated: use `.full`. - /// Returns a set containing all possible keys. - pub fn initFull() Self { - return .full; - } - /// Returns a set containing multiple keys. pub fn initMany(keys: []const Key) Self { var set: Self = .empty; diff --git a/lib/std/mem.zig b/lib/std/mem.zig index 07c197fbc244b2831e31bdcbbaf4465dee6bfee1..7aea379efb5bb45e20de370e9f8433bd04d58a41 100644 --- a/lib/std/mem.zig +++ b/lib/std/mem.zig @@ -1691,7 +1691,7 @@ test countScalar { // /// See also: `containsAtLeastScalar` pub fn containsAtLeast(comptime T: type, haystack: []const T, expected_count: usize, needle: []const T) bool { - if (needle.len == 1) return containsAtLeastScalar(T, haystack, expected_count, needle[0]); + if (needle.len == 1) return containsAtLeastScalar(T, haystack, needle[0], expected_count); assert(needle.len > 0); if (expected_count == 0) return true; @@ -1722,17 +1722,12 @@ test containsAtLeast { try testing.expect(!containsAtLeast(u8, " radar radar ", 3, "radar")); } -/// Deprecated in favor of `containsAtLeastScalar2`. -pub fn containsAtLeastScalar(comptime T: type, list: []const T, minimum: usize, element: T) bool { - return containsAtLeastScalar2(T, list, element, minimum); -} - /// Returns true if `element` appears at least `minimum` number of times in `list`. // /// Related: /// * `containsAtLeast` /// * `countScalar` -pub fn containsAtLeastScalar2(comptime T: type, list: []const T, element: T, minimum: usize) bool { +pub fn containsAtLeastScalar(comptime T: type, list: []const T, element: T, minimum: usize) bool { const n = list.len; var i: usize = 0; var found: usize = 0; @@ -1760,14 +1755,14 @@ pub fn containsAtLeastScalar2(comptime T: type, list: []const T, element: T, min return false; } -test containsAtLeastScalar2 { - try testing.expect(containsAtLeastScalar2(u8, "aa", 'a', 0)); - try testing.expect(containsAtLeastScalar2(u8, "aa", 'a', 1)); - try testing.expect(containsAtLeastScalar2(u8, "aa", 'a', 2)); - try testing.expect(!containsAtLeastScalar2(u8, "aa", 'a', 3)); +test containsAtLeastScalar { + try testing.expect(containsAtLeastScalar(u8, "aa", 'a', 0)); + try testing.expect(containsAtLeastScalar(u8, "aa", 'a', 1)); + try testing.expect(containsAtLeastScalar(u8, "aa", 'a', 2)); + try testing.expect(!containsAtLeastScalar(u8, "aa", 'a', 3)); - try testing.expect(containsAtLeastScalar2(u8, "adadda", 'd', 3)); - try testing.expect(!containsAtLeastScalar2(u8, "adadda", 'd', 4)); + try testing.expect(containsAtLeastScalar(u8, "adadda", 'd', 3)); + try testing.expect(!containsAtLeastScalar(u8, "adadda", 'd', 4)); } /// Reads an integer from memory with size equal to bytes.len. @@ -1973,18 +1968,6 @@ fn readPackedIntBig(comptime T: type, bytes: []const u8, bit_offset: usize) T { } else return @as(T, @bitCast(val)); } -/// Deprecated: use readPackedInt(T, bytes, bit_offset, value, .native) -pub const readPackedIntNative = switch (native_endian) { - .little => readPackedIntLittle, - .big => readPackedIntBig, -}; - -/// Deprecated: use readPackedInt(T, bytes, bit_offset, value, .foreign) -pub const readPackedIntForeign = switch (native_endian) { - .little => readPackedIntBig, - .big => readPackedIntLittle, -}; - /// Loads an integer from packed memory. /// Asserts that buffer contains at least bit_offset + @bitSizeOf(T) bits. pub fn readPackedInt(comptime T: type, bytes: []const u8, bit_offset: usize, endian: Endian) T { @@ -2128,18 +2111,6 @@ fn writePackedIntBig(comptime T: type, bytes: []u8, bit_offset: usize, value: T) writeInt(StoreInt, write_bytes[(byte_count - store_size)..][0..store_size], write_value, .big); } -/// Deprecated: use writePackedInt(T, bytes, bit_offset, value, .native) -pub const writePackedIntNative = switch (native_endian) { - .little => writePackedIntLittle, - .big => writePackedIntBig, -}; - -/// Deprecated: use writePackedInt(T, bytes, bit_offset, value, .foreign) -pub const writePackedIntForeign = switch (native_endian) { - .little => writePackedIntBig, - .big => writePackedIntLittle, -}; - /// Stores an integer to packed memory. /// Asserts that buffer contains at least bit_offset + @bitSizeOf(T) bits. pub fn writePackedInt(comptime T: type, bytes: []u8, bit_offset: usize, value: T, endian: Endian) void { diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index d657a133ac167b997b8dd1efdb6c1474a9520271..ee4670070cd9989401703fe82083f2866ef23a71 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -1151,10 +1151,10 @@ const FileType = enum { /// Parameter is a content-disposition header value. fn fromContentDisposition(cd_header: []const u8) ?FileType { - const attach_end = ascii.indexOfIgnoreCase(cd_header, "attachment;") orelse + const attach_end = ascii.findIgnoreCase(cd_header, "attachment;") orelse return null; - var value_start = ascii.indexOfIgnoreCasePos(cd_header, attach_end + 1, "filename") orelse + var value_start = ascii.findIgnoreCasePos(cd_header, attach_end + 1, "filename") orelse return null; value_start += "filename".len; if (cd_header[value_start] == '*') { diff --git a/src/codegen/x86_64/CodeGen.zig b/src/codegen/x86_64/CodeGen.zig index a40a61f5ae66e7ec66bed201eeb79e5788c6fddf..05556aaed9354259112cee2796396bc6c283a519 100644 --- a/src/codegen/x86_64/CodeGen.zig +++ b/src/codegen/x86_64/CodeGen.zig @@ -187562,9 +187562,7 @@ const Temp = struct { const max = std.math.maxInt(@typeInfo(Index).@"enum".tag_type); const Set = std.bit_set.Static(max); const SafetySet = if (std.debug.runtime_safety) Set else struct { - inline fn initEmpty() @This() { - return .{}; - } + pub const empty: @This() = .{}; inline fn isSet(_: @This(), index: usize) bool { assert(index < max);