diff --git a/src/shell.zig b/src/shell.zig index 0534d6d..d17c2b3 100644 --- a/src/shell.zig +++ b/src/shell.zig @@ -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, };