pub fn sizeInBytes(self: Self) usize self: Self119
120
121
122
123
124
125
126
127
128
129
130 pub fn sizeInBytes(self: Self) usize {
var off: usize = 0;
inline for (@typeInfo(Fields).@"struct".field_types, 0..) |field_type, i| {
if (@sizeOf(field_type) == 0)
continue;
if ((self.bits & (1 << i)) != 0) {
off = mem.alignForward(usize, off, @alignOf(field_type));
off += @sizeOf(field_type);
}
}
return off;
}