Skip to content

Commit

Permalink
fix a bug in the alignment calculation logic
Browse files Browse the repository at this point in the history
fixes a weird failing test case that was uncovered recently somehow...
  • Loading branch information
TooTallNate committed Jun 1, 2012
1 parent e52a132 commit 4c317f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/struct.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ function recalc (struct) {
fieldNames.forEach(function (name) {
var field = struct.fields[name]
var type = field.type
var alignment = type.alignment || ref.sizeof.pointer
var alignment = type.alignment || ref.alignof.pointer
if (type.indirection > 1) {
alignment = ref.alignof.pointer
}
struct.alignment = Math.max(struct.alignment, alignment)
})

Expand Down

0 comments on commit 4c317f4

Please sign in to comment.