Commit ccdba774c8

Andrew Kelley <andrew@ziglang.org>
2021-04-08 00:02:46
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.
1 parent 015599d
Changed files (1)
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{