From 75c717bd064ac8cd21ee32b57b73b2a8673f1e41 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 8 May 2026 22:12:27 +0100 Subject: [PATCH] std.bit_set, std.enums: Remove .init{Empty,Full}() in favor of .empty/.full --- lib/compiler/aro/backend/Ir/x86/Renderer.zig | 6 ++--- lib/std/bit_set.zig | 24 -------------------- lib/std/enums.zig | 12 ---------- src/codegen/x86_64/CodeGen.zig | 4 +--- 4 files changed, 4 insertions(+), 42 deletions(-) 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/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/src/codegen/x86_64/CodeGen.zig b/src/codegen/x86_64/CodeGen.zig index 2677c0638fb676ff8b2e476c23d8a96aa6cf5d3d..452270b99c3b4c0a59b0cb2ccdddf50c6fb0879e 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); -- 2.54.0