3.1.5.4.3.1.3 Bitmask Command (0x42)
The Bitmask command, as specified in section 2.2.2.6.3, is used when there are multiple GLOBCNT ranges, as specified in section 2.2.2.5, that share five high-order bytes in common and the low-order bytes are all within 8 values of each other. Each GLOBCNT range is represented by one or more bits in a bitmask. There MUST already be five high-order bytes in the common byte stack to use this command. The Bitmask command can only represent at most five GLOBCNT ranges.
For more details about the format of the Bitmask command and its fields, see section 2.2.2.6.3.
The StartingValue field, as specified in section 2.2.2.6.3, MUST be set to the low-order byte of the low value of the first GLOBCNT range. The Bitmask field, specified in section 2.2.2.6.3, MUST have one bit set for each value within a range, excluding the low value of the first GLOBCNT range. The bit to set for each value within a range is determined by subtracting the low-order byte of the GLOBCNT from one more than the value of the StartingValue field. This produces a 0 based bit number value, where zero (0) is the lowest order bit and 7 is the highest order bit in the Bitmask field. For all GLOBCNTs between ranges, the bit associated with the value is not set in the bitmask.
For example, given a set of ranges where all have the same five high-order bytes in common and the low-order bytes are the values {0x01-0x03, 0x05-0x05, 0x07-0x09}, it would be encoded with a value for the StartingValue field of 0x01 and the value of the Bitmask field would be 0xEB. The value of the Bitmask field is broken down in the following table.
Low-Order Byte Value |
0x09 |
0x08 |
0x07 |
0x06 |
0x05 |
0x04 |
0x03 |
0x02 |
---|---|---|---|---|---|---|---|---|
Bit Number |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Bit Value |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
If you take the value of the StartingValue field and each low-order byte value corresponding to a bit that is set in the Bitmask field, you end up with the low-order byte values {0x01, 0x02, 0x03, 0x05, 0x07, 0x08, 0x09}. If you collapse these into ranges, you have {0x01-0x03, 0x05-0x05, 0x07-0x09}.