2.2.2.4 FOUR_BYTE_SIGNED_INTEGER
The FOUR_BYTE_SIGNED_INTEGER structure is used to encode a value in the range -0x1FFFFFFF to 0x1FFFFFFF by using a variable number of bytes. For example, -0x001A1B1C is encoded as {0xBA, 0x1B, 0x1C}, and -0x00000002 is encoded as {0x22}. The three most significant bits of the first byte encode the number of bytes in the structure and the sign.
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c |
s |
val1 |
val2 (optional) |
val3 (optional) |
val4 (optional) |
c (2 bits): A 2-bit unsigned integer field containing an encoded representation of the number of bytes in this structure.
-
Value
Meaning
ONE_BYTE_VAL
0
Implies that the optional val2, val3, and val4 fields are not present. Hence, the structure is 1 byte in size.
TWO_BYTE_VAL
1
Implies that the optional val2 field is present, while the optional val3 and val4 fields are not present. Hence, the structure is 2 bytes in size.
THREE_BYTE_VAL
2
Implies that the optional val2 and val3 fields are present, while the optional val4 field is not present. Hence, the structure is 3 bytes in size.
FOUR_BYTE_VAL
3
Implies that the optional val2, val3, and val4 fields are all present. Hence, the structure is 4 bytes in size.
s (1 bit): A 1-bit unsigned integer field containing an encoded representation of whether the value is positive or negative.
-
Value
Meaning
POSITIVE_VAL
0
Implies that the value represented by this structure is positive.
NEGATIVE_VAL
1
Implies that the value represented by this structure is negative.
val1 (5 bits): A 5-bit unsigned integer field containing the most significant 5 bits of the value represented by this structure.
val2 (1 byte, optional): An 8-bit unsigned integer containing the second most significant bits of the value represented by this structure.
val3 (1 byte, optional): An 8-bit unsigned integer containing the third most significant bits of the value represented by this structure.
val4 (1 byte, optional): An 8-bit unsigned integer containing the least significant bits of the value represented by this structure.