Hi everyone,
I am a new daffodil user and I was looking for input on a DFDL schema definition I'm trying to create. I'm working with some binary physics data, the format of which can loosely be described as fields that are aggregated together and packed into a single 32-bit integer before being written to memory. The gist of the issue is that because not all fields fall nicely on 1-byte divisions, different pieces of a field will get jumbled if you read the data as a linear stream from memory. This is best illustrated by a simple example: Consider the following 32-bit hex value: 0x90 00 20 01 The problem arises because the values that have meaning in context are 0x9 (consisting of 4 bits), 0x0002 (16 bits), and finally 0x001 (12 bits). When this value gets stored in memory on a little endian architecture we see the following: 0x01 20 00 90. Trying to read those bit sequences as a stream from memory will yield 0x0, 0x1200, and 0x090, which are clearly incorrect. The simplest approach I can envision is to read in the value as an entire 32-bit value and then perform some processing via masks/bit shift in order to extract the correct values. Is there a more straightforward solution to this problem? or does anyone have experience or insights solving this issue using daffodil? Thanks! Brett
