authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-21 12:44:25-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-21 17:03:03-07:00
logf21a3ed5406d453a4d17c0c891901eaafa806c07
treeff8f1218823ca91f1da2881ad06b697ec12371d5
parent98b10d94bf88a7e07690663008eb3f3dc8bfceca

std.TrailerFlags: remove superfluous parameter


1 files changed, 3 insertions(+), 4 deletions(-)

lib/std/meta/trailer_flags.zig+3-4
......@@ -96,19 +96,18 @@ pub fn TrailerFlags(comptime Fields: type) type {
9696 pub fn ptr(self: Self, p: [*]align(@alignOf(Fields)) u8, comptime field: FieldEnum) *Field(field) {
9797 if (@sizeOf(Field(field)) == 0)
9898 return undefined;
99 const off = self.offset(p, field);
99 const off = self.offset(field);
100100 return @ptrCast(*Field(field), @alignCast(@alignOf(Field(field)), p + off));
101101 }
102102
103103 pub fn ptrConst(self: Self, p: [*]align(@alignOf(Fields)) const u8, comptime field: FieldEnum) *const Field(field) {
104104 if (@sizeOf(Field(field)) == 0)
105105 return undefined;
106 const off = self.offset(p, field);
106 const off = self.offset(field);
107107 return @ptrCast(*const Field(field), @alignCast(@alignOf(Field(field)), p + off));
108108 }
109109
110 pub fn offset(self: Self, p: [*]align(@alignOf(Fields)) const u8, comptime field: FieldEnum) usize {
111 _ = p;
110 pub fn offset(self: Self, comptime field: FieldEnum) usize {
112111 var off: usize = 0;
113112 inline for (@typeInfo(Fields).Struct.fields) |field_info, i| {
114113 const active = (self.bits & (1 << i)) != 0;