std: loop in trailer flags can be indexing operation

This commit is contained in:
daurnimator
2020-12-13 23:14:51 +11:00
committed by Andrew Kelley
parent 4387e50d4f
commit bbab5e19b4

View File

@@ -122,10 +122,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
}
pub fn Field(comptime field: FieldEnum) type {
inline for (@typeInfo(Fields).Struct.fields) |field_info, i| {
if (i == @enumToInt(field))
return field_info.field_type;
}
return @typeInfo(Fields).Struct.fields[@enumToInt(field)].field_type;
}
pub fn sizeInBytes(self: Self) usize {