Skip to content

Commit

Permalink
Fix struct padding calculations.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent d35f10a commit 41ed619
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions impeller/compiler/reflector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@ std::vector<StructMember> Reflector::ReadStructMembers(

const auto struct_length = current_byte_offset;
{
const auto padding = struct_length % max_member_alignment;
if (padding != 0) {
const auto excess = struct_length % max_member_alignment;
if (excess != 0) {
const auto padding = max_member_alignment - excess;
result.emplace_back(StructMember{
.type = TypeNameWithPaddingOfSize(padding),
.name = "_PADDING_",
Expand Down

0 comments on commit 41ed619

Please sign in to comment.