-
Notifications
You must be signed in to change notification settings - Fork 71
Update alignment to handle terminator alignment #1601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add support for including terminator MTA and length in `endingAlignmentApprox` calculations. - Introduce `terminatorMTAApprox` and `terminatorLengthApprox` for reusable terminator alignment logic. - Add new test cases (`test_sep_alignment_5`, `test_sep_alignment_6`) to validate terminator alignment in sequences. - Update comments DAFFODIL-3057
stevedlawrence
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Looks good, just minor cleanup/corrections
| LengthMultipleOf(t.knownEncodingAlignmentInBits) | ||
| case _ => LengthMultipleOf(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these want to be AlignmentMultipleOf since they represent an alignment and not a length. I imagine the math ends up the same. Though maybe the default case then becomes AlignmentMultipleOf(1)?
| } | ||
|
|
||
| private lazy val terminatorMTAApprox = | ||
| this match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this match case be simplified to an if-statement?
| case t if t.hasTerminator => | ||
| getEncodingLengthApprox(t) | ||
| case _ => LengthMultipleOf(0) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, can this be simplified to an if-statement?
| + trailingSkipApprox | ||
| ) | ||
| res | ||
| } else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding the same three fields to a bunch of places in the various conditions can we do something like
val contentEndAlignment = ... //existing logic
val res =
contentEndAlignment
+ terminatorMTAAPprox
+ terminatorLengthApprox
+ trailingSkipApproxI'm not sure if contentEndAlignment is the right name, but something along those lines?
- MTA are alignments not lengths - simplify pattern matching to if statement - refactor duplicate addition of terminator + trailing skip DAFFODIL-2295
|
Subsumed by #1604 |
endingAlignmentApproxcalculations.terminatorMTAApproxandterminatorLengthApproxfor reusable terminator alignment logic.test_sep_alignment_5,test_sep_alignment_6) to validate terminator alignment in sequences.DAFFODIL-3057