authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-08 22:12:27+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2026-05-08 22:12:27+01:00
log75c717bd064ac8cd21ee32b57b73b2a8673f1e41
tree5163a0ea2c2db8a499da67d611cafa1670beb8f5
parent33d2e571c763ca1f0d2d97803ece92b49a54aac5

std.bit_set, std.enums: Remove .init{Empty,Full}() in favor of .empty/.full


4 files changed, 4 insertions(+), 42 deletions(-)

lib/compiler/aro/backend/Ir/x86/Renderer.zig+3-3
...@@ -21,17 +21,17 @@ const RegisterManager = zig.RegisterManager(Renderer, Register, Ir.Ref, abi.allo...@@ -21,17 +21,17 @@ const RegisterManager = zig.RegisterManager(Renderer, Register, Ir.Ref, abi.allo
21const RegisterBitSet = RegisterManager.RegisterBitSet;21const RegisterBitSet = RegisterManager.RegisterBitSet;
22const RegisterClass = struct {22const RegisterClass = struct {
23 const gp: RegisterBitSet = blk: {23 const gp: RegisterBitSet = blk: {
24 var set = RegisterBitSet.initEmpty();24 var set: RegisterBitSet = .empty;
25 for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .general_purpose) set.set(index);25 for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .general_purpose) set.set(index);
26 break :blk set;26 break :blk set;
27 };27 };
28 const x87: RegisterBitSet = blk: {28 const x87: RegisterBitSet = blk: {
29 var set = RegisterBitSet.initEmpty();29 var set: RegisterBitSet = .empty;
30 for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .x87) set.set(index);30 for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .x87) set.set(index);
31 break :blk set;31 break :blk set;
32 };32 };
33 const sse: RegisterBitSet = blk: {33 const sse: RegisterBitSet = blk: {
34 var set = RegisterBitSet.initEmpty();34 var set: RegisterBitSet = .empty;
35 for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .sse) set.set(index);35 for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .sse) set.set(index);
36 break :blk set;36 break :blk set;
37 };37 };
lib/std/bit_set.zig-24
...@@ -73,18 +73,6 @@ pub fn Integer(comptime size: u16) type {...@@ -73,18 +73,6 @@ pub fn Integer(comptime size: u16) type {
73 /// The bit mask, as a single integer73 /// The bit mask, as a single integer
74 mask: MaskInt,74 mask: MaskInt,
7575
76 /// Deprecated: use `.empty`.
77 /// Creates a bit set with no elements present.
78 pub fn initEmpty() Self {
79 return .{ .mask = 0 };
80 }
81
82 /// Deprecated: use `.full`.
83 /// Creates a bit set with all elements present.
84 pub fn initFull() Self {
85 return .{ .mask = ~@as(MaskInt, 0) };
86 }
87
88 /// A bit set with no elements present.76 /// A bit set with no elements present.
89 pub const empty: Self = .{ .mask = 0 };77 pub const empty: Self = .{ .mask = 0 };
9078
...@@ -403,18 +391,6 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {...@@ -403,18 +391,6 @@ pub fn Array(comptime MaskIntType: type, comptime size: usize) type {
403 /// Padding bits at the end are undefined.391 /// Padding bits at the end are undefined.
404 masks: [num_masks]MaskInt,392 masks: [num_masks]MaskInt,
405393
406 /// Deprecated: use `.empty`.
407 /// Creates a bit set with no elements present.
408 pub fn initEmpty() Self {
409 return .empty;
410 }
411
412 /// Deprecated: use `.full`.
413 /// Creates a bit set with all elements present.
414 pub fn initFull() Self {
415 return .full;
416 }
417
418 /// A bit set with no elements present.394 /// A bit set with no elements present.
419 pub const empty: Self = .{ .masks = @splat(0) };395 pub const empty: Self = .{ .masks = @splat(0) };
420396
lib/std/enums.zig-12
...@@ -284,18 +284,6 @@ pub fn EnumSet(comptime E: type) type {...@@ -284,18 +284,6 @@ pub fn EnumSet(comptime E: type) type {
284 /// A set containing all possible keys.284 /// A set containing all possible keys.
285 pub const full: Self = .{ .bits = .full };285 pub const full: Self = .{ .bits = .full };
286286
287 /// Deprecated: use `.empty`.
288 /// Returns a set containing no keys.
289 pub fn initEmpty() Self {
290 return .empty;
291 }
292
293 /// Deprecated: use `.full`.
294 /// Returns a set containing all possible keys.
295 pub fn initFull() Self {
296 return .full;
297 }
298
299 /// Returns a set containing multiple keys.287 /// Returns a set containing multiple keys.
300 pub fn initMany(keys: []const Key) Self {288 pub fn initMany(keys: []const Key) Self {
301 var set: Self = .empty;289 var set: Self = .empty;
src/codegen/x86_64/CodeGen.zig+1-3
...@@ -187562,9 +187562,7 @@ const Temp = struct {...@@ -187562,9 +187562,7 @@ const Temp = struct {
187562 const max = std.math.maxInt(@typeInfo(Index).@"enum".tag_type);187562 const max = std.math.maxInt(@typeInfo(Index).@"enum".tag_type);
187563 const Set = std.bit_set.Static(max);187563 const Set = std.bit_set.Static(max);
187564 const SafetySet = if (std.debug.runtime_safety) Set else struct {187564 const SafetySet = if (std.debug.runtime_safety) Set else struct {
187565 inline fn initEmpty() @This() {187565 pub const empty: @This() = .{};
187566 return .{};
187567 }
187568187566
187569 inline fn isSet(_: @This(), index: usize) bool {187567 inline fn isSet(_: @This(), index: usize) bool {
187570 assert(index < max);187568 assert(index < max);