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.
This commit is contained in:
Andrew Kelley 2021-04-07 15:02:46 -07:00
parent 015599d1ef
commit ccdba774c8

View File

@ -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{