stevedlawrence commented on a change in pull request #29: Fixed bug in
calculating bit length for delimited unparsing
URL: https://github.com/apache/incubator-daffodil/pull/29#discussion_r163660631
##########
File path:
daffodil-runtime1-unparser/src/main/scala/edu/illinois/ncsa/daffodil/processors/unparsers/BCDUnparsers.scala
##########
@@ -54,7 +54,14 @@ final class BCDIntegerMinLengthInBytesUnparser(
extends BCDIntegerBaseUnparser(e) {
override def getBitLength(state: ParseOrUnparseState): Int = {
- val len =
state.currentNode.get.asSimple.dataValue.asInstanceOf[Array[Byte]].length * 8
+ val bitLen =
state.currentNode.get.asSimple.dataValue.asInstanceOf[JBigInteger].bitLength
Review comment:
It might be worth adding some tdml:unparserTestCase cases to ensure that
minLength is behaving correctly. This feels to me like maybe we're adding more
pad characters than is necessary and things just work because extra pad chars
is okay?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services