mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
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.
This commit is contained in:
parent
cba7e8a4e9
commit
1a0e6bcdb1
@ -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),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user