From ef4062edb786daa5e03168bc178fa76b5e370641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 6 Jun 2023 18:51:18 +0300 Subject: [PATCH] doc nitpicks --- src/DB.zig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/DB.zig b/src/DB.zig index 7e2105f..92018a9 100644 --- a/src/DB.zig +++ b/src/DB.zig @@ -249,9 +249,7 @@ pub fn fieldOffsets(lengths: DBNumbers) DBNumbers { var result: DBNumbers = undefined; result.header = 0; var offset = comptime nblocks_n(u64, @sizeOf(Header)); - // skipping header (so index 1). This used to be an inline for with stage1, - // but that and a comptime assertion crashes the compiler as of - // 0.11.0-dev.1580+a5b34a61a + // skipping header (so starting with index 1) inline for (DB_fields[1..], meta.fields(DBNumbers)[1..]) |db_field, dbn_field| { assert(mem.eql(u8, db_field.name, dbn_field.name)); @field(result, db_field.name) = offset; @@ -280,9 +278,7 @@ pub fn fromBytes(buf: []align(8) const u8) InvalidHeader!DB { } pub fn packCGroupNoMembers(group: *const PackedGroup, buf: []u8) error{BufferTooSmall}!CGroup { - // first word in buf will be a pointer to null. that probably can be - // simplified by writing (0)**word_size to the buffer, but let's pretend - // type safety for a moment. + // First word in buf will be a pointer to null. const name_start = @sizeOf(?[*:0]const u8); if (name_start > buf.len) return error.BufferTooSmall; var member_ptrs = mem.bytesAsSlice(?[*:0]const u8, buf[0..name_start]); @@ -729,7 +725,7 @@ pub fn nblocks_n(comptime T: type, nbytes: usize) T { u16 => u22, u32 => u38, u64 => u70, - else => @compileError("got " ++ @typeName(T) ++ ", only u8, u32 and u64 are supported"), + else => @compileError("unsupported type " ++ @typeName(T)), }; const upper = @intCast(B, mem.alignForward(nbytes, section_length)); assert(upper & (section_length - 1) == 0);