mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
bpf: use bitCast instead of intCast in ld_imm_impl
Any 32 bit immediate is allowed in a BPF instruction, including those greater than the largest positive i32 value.
This commit is contained in:
parent
8744865425
commit
496313a1bd
1 changed files with 2 additions and 2 deletions
|
|
@ -642,7 +642,7 @@ pub const Insn = packed struct {
|
|||
.dst = @intFromEnum(dst),
|
||||
.src = @intFromEnum(src),
|
||||
.off = 0,
|
||||
.imm = @as(i32, @intCast(@as(u32, @truncate(imm)))),
|
||||
.imm = @as(i32, @bitCast(@as(u32, @truncate(imm)))),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -652,7 +652,7 @@ pub const Insn = packed struct {
|
|||
.dst = 0,
|
||||
.src = 0,
|
||||
.off = 0,
|
||||
.imm = @as(i32, @intCast(@as(u32, @truncate(imm >> 32)))),
|
||||
.imm = @as(i32, @bitCast(@as(u32, @truncate(imm >> 32)))),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue