fix shell index offsets
This commit is contained in:
parent
13b75e8046
commit
fd1cab251d
@ -17,7 +17,7 @@ pub const ShellReader = struct {
|
||||
|
||||
pub fn init(index: []const u8, blob: []const u8) ShellReader {
|
||||
return ShellReader{
|
||||
.sectionIndex = @bitCast([]const ShellIndex, index),
|
||||
.sectionIndex = std.mem.bytesAsSlice(ShellIndex, index),
|
||||
.sectionBlob = blob,
|
||||
};
|
||||
}
|
||||
@ -78,7 +78,7 @@ pub const ShellWriter = struct {
|
||||
}
|
||||
|
||||
pub fn sectionIndex(self: *const ShellSections) []const u8 {
|
||||
return @bitCast([]const u8, self.index.constSlice());
|
||||
return std.mem.sliceAsBytes(self.index.constSlice());
|
||||
}
|
||||
|
||||
pub fn sectionBlob(self: *const ShellSections) []const u8 {
|
||||
@ -176,7 +176,7 @@ inline fn roundUp4Padding(n: u12) u12 {
|
||||
// to 4 bytes.
|
||||
// The actual shell length is len+1: we don't allow empty shells, and the real
|
||||
// length of the shell is 1-64 bytes.
|
||||
const ShellIndex = struct {
|
||||
const ShellIndex = packed struct {
|
||||
offset: u10,
|
||||
len: u6,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user