stevedlawrence commented on code in PR #1604:
URL: https://github.com/apache/daffodil/pull/1604#discussion_r2635945731


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/AlignedMixin.scala:
##########
@@ -228,29 +235,161 @@ trait AlignedMixin extends GrammarMixin { self: Term =>
       }
     }.value
 
+  private lazy val separatorPrefixMTAApprox =
+    this.optLexicalParent match {
+      case Some(s: SequenceTermBase) if s.hasSeparator =>
+        import SeparatorPosition.*
+        s.separatorPosition match {
+          case Prefix | Infix => 
LengthMultipleOf(s.knownEncodingAlignmentInBits)

Review Comment:
   The `separatorPrefixMTAApprox` val, and other MTAApprox vals are calculating 
where the MTA region needs to align to, not how big the region is.
   
   This way we can look at approximate end alignment (we should probably call 
this approximate position) of whatever came before the MTA region and determine 
if the MTA region is known to already be aligned and so can be excluded.
   
   And then based on the previous alignment and the MTA, we can then calculate 
where that MTA will have put us. For example, we might know it just put us on a 
byte boundary, but we might know more and know that it actually put us on a 
2-byte boundary, allowing for better optimizations if a later elements needs to 
be 2-byte aligned.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to