[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can someone tell me if this is a bug (or i am just reading the documentation wrong based on
how i think it should be)?
I am taking messages in "binary" form and parsing off integers and strings. I declare one
array to be of element type 'string-char and to be of a length that allows 4 bytes (string-chars)
per integer and one byte (string-char) per character. This works peachy. In order to
parse the array, i displace an integer array to it using the following code:
For example, if the binary message contains 6 integers followed by a string and i want to parse off
the 3rd integer, num-ints will be 1, start-byte will be 8 (because there are 4 bytes per int).
Well, this doesn't work at all. I assumed that :displaced-index-offset was the index in the primary
array. This code works if i use start-int (in this example, 2), the index into the displaced integer
I know that displacing arrays not of like types is not recommended, so it isn't talked about a whole
lot. Is this the expected behavior? It seems a little (a LITTLE!) odd to me since the length of the
array (in this case 1) is longer than the index (in this case 2) and the index 2 makes no sense in
the first array (it represents the 3rd byte of a 4-byte integer).
Any insight into this matter would be appreciated. The code works but is the source of mental distress.