sizeInBytes
Function parameters
Parameters
This is useful for saving memory when allocating an object that has many
Functions
- TrailerFlags
- This is useful for saving memory when allocating an object that has many
Source
Implementation
pub fn sizeInBytes(self: Self) usize {
var off: usize = 0;
inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, 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;
}