mbeckerle 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_r163704199
 
 

 ##########
 File path: 
daffodil-runtime1-unparser/src/main/scala/edu/illinois/ncsa/daffodil/processors/unparsers/IBM4690PackedDecimalUnparsers.scala
 ##########
 @@ -54,7 +54,21 @@ final class IBM4690PackedIntegerMinLengthInBytesUnparser(
   extends IBM4690PackedIntegerBaseUnparser(e) {
 
   override def getBitLength(state: ParseOrUnparseState): Int = {
-    val len = 
state.currentNode.get.asSimple.dataValue.asInstanceOf[Array[Byte]].length * 8
+    val num = 
state.currentNode.get.asSimple.dataValue.asInstanceOf[JBigInteger]
+    // If negative account for sign nibble
 
 Review comment:
   If I understand this correctly, IBM4690 packed numbers only have sign 
nibbles when they are negative. If positive there is no sign nibble. Is that 
right? If so, please add a comment to the code stating this, as it is quite 
unintuitive, and otherwise someone might "fix" this code to be symmetric 
thinking it is broken, etc. 

----------------------------------------------------------------
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

Reply via email to