Skip to content

Commit 41ed619

Browse files
chinmaygardednfield
authored andcommitted
Fix struct padding calculations.
1 parent d35f10a commit 41ed619

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

impeller/compiler/reflector.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,9 @@ std::vector<StructMember> Reflector::ReadStructMembers(
528528

529529
const auto struct_length = current_byte_offset;
530530
{
531-
const auto padding = struct_length % max_member_alignment;
532-
if (padding != 0) {
531+
const auto excess = struct_length % max_member_alignment;
532+
if (excess != 0) {
533+
const auto padding = max_member_alignment - excess;
533534
result.emplace_back(StructMember{
534535
.type = TypeNameWithPaddingOfSize(padding),
535536
.name = "_PADDING_",

0 commit comments

Comments
 (0)