Can I change the alignment of a struct? I am trying to reinterpret some bytes I get as a struct
var buffer = [_]u8{0} ** 16;
_ = try std.os.read(fd, &buffer);
const response_header: *HciMessageHeader = @ptrCast(&buffer[0]);
And I have defined HciMessageHeader as
const HciMessageHeader align(1) = packed struct {
op_code: u16,
index: u16,
len: u16,
};
Compiler tells me that HciMessageHeader has an alignment of 8. I thought I could change that with align(1) but it seems to have no effect. I also tried to set the alignment when defining the response_header variable that also had no effect.
Is it not possible to change the alignment of a packed struct?
Thanks