I am trying to recreate a data type in java used by adobe, it is an unsigned integer 30 bits long or U30 by the specification. Anyway i am having problems understanding the binary output, the definition states:
"The variable-length encoding for u30 uses one to five bytes, depending on the magnitude of the value encoded. Each byte contributes its low seven bits to the value. If the high (eighth) bit of a byte is set, then the next byte of the abcFile is also part of the value."- learn.adobe.com/wiki/display/AVM2/4.1+Primitive+data+types
In order to understand the output i took a look at a simple compiled actionscript file containing a U30 and got:
00011101 00000100 01001101 01100001 Hx 1D 4 4D 61
This was the binary output from a simple u30 structure, the value should be a count of the number of integer values in the script. However when i add more integer values to the script the output becomes:
00100010 00000100 01001101 01100001 Hx 21 4 4D 61
Essentially only affecting the first byte, which would be understandable, however the script file only contains 3 extra integer values, so i am confused as to how the first byte starts with a decimal value of 29 integers?
So could anyone tell me the best way to implement this data type, and whether it is the bit arrangement that makes it start with 28 values?