From ccdba774c84e2b3c7f650e27f430c9a3eed78fd3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 7 Apr 2021 15:02:46 -0700 Subject: AstGen: fix ZIR struct encoding off by one error in the bits that describe defaults/field alignments as soon as we have tests for struct field alignment and default values, there will be coverage for this. --- src/AstGen.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/AstGen.zig') diff --git a/src/AstGen.zig b/src/AstGen.zig index 6149169c7f..61174367c3 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1857,7 +1857,7 @@ fn containerDecl( field_index += 1; } - const empty_slot_count = 16 - ((field_index - 1) % 16); + const empty_slot_count = 16 - (field_index % 16); cur_bit_bag >>= @intCast(u5, empty_slot_count * 2); const result = try gz.addPlNode(tag, node, zir.Inst.StructDecl{ -- cgit v1.2.3