constructing header
This commit is contained in:
@@ -38,6 +38,8 @@ pub const ShellWriter = struct {
|
||||
};
|
||||
|
||||
pub const ShellSections = struct {
|
||||
// len is the number of shells in this section.
|
||||
len: u8,
|
||||
// index points the i'th shell to it's offset in blob. The last
|
||||
// byte of the i'th shell is index[i+1].
|
||||
index: BoundedArray(u16, max_shells),
|
||||
@@ -55,6 +57,7 @@ pub const ShellWriter = struct {
|
||||
shells: BoundedArray([]const u8, max_shells),
|
||||
) error{ Overflow, OutOfMemory }!ShellSections {
|
||||
var self = ShellSections{
|
||||
.len = @intCast(u8, shells.len),
|
||||
.index = try BoundedArray(u16, max_shells).init(shells.len),
|
||||
.blob = try BoundedArray(u8, (max_shells + 1) * max_shell_len).init(0),
|
||||
.shell2idx = StringHashMap(u8).init(allocator),
|
||||
|
||||
Reference in New Issue
Block a user