zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 75c717bd064ac8cd21ee32b57b73b2a8673f1e41 (tree)
parent 33d2e571c763ca1f0d2d97803ece92b49a54aac5
Author: Linus Groh <mail@linusgroh.de>
Date:   Fri,  8 May 2026 22:12:27 +0100

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

Diffstat:
Mlib/compiler/aro/backend/Ir/x86/Renderer.zig | 6+++---
Mlib/std/bit_set.zig | 24------------------------
Mlib/std/enums.zig | 12------------
Msrc/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 @@ -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 @@ -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 @@ -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 @@ -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);