zig

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

commit 1a0e6bcdb140c844384d62b78a7f4247753f9ffd (tree)
parent cba7e8a4e95aa2a2031d0fbaa8247de37e61fd78
Author: bfredl <bjorn.linse@gmail.com>
Date:   Thu, 14 Sep 2023 23:08:27 +0200

bpf: remove unhelpful "comptime" and fix union order

Insn.st() can be used with dynamic size just like Insn.stx(), which is
relevant in a code generation context.

using ImmOrReg caused an error as its fields were ordered differently than
Source.

Diffstat:
Mlib/std/os/linux/bpf.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/std/os/linux/bpf.zig b/lib/std/os/linux/bpf.zig @@ -455,8 +455,8 @@ pub const Insn = packed struct { }; const ImmOrReg = union(Source) { - imm: i32, reg: Reg, + imm: i32, }; fn imm_reg(code: u8, dst: Reg, src: anytype, off: i16) Insn { @@ -673,7 +673,7 @@ pub const Insn = packed struct { return ld_imm_impl2(@as(u64, @intCast(map_fd))); } - pub fn st(comptime size: Size, dst: Reg, off: i16, imm: i32) Insn { + pub fn st(size: Size, dst: Reg, off: i16, imm: i32) Insn { return Insn{ .code = MEM | @intFromEnum(size) | ST, .dst = @intFromEnum(dst),