* Read in the header descriptor of an object or an array. * If the highest bit is set (7), then the index is bigger than 127 * elements, so use the next byte to read in the real value. * The actual value is then both bytes added with the first shifted * 8 bits to the left, and dropping the highest bit (which only indicated a big index). * x = ((x & 0x7F) << 8) + SlReadByte(); * @return Retur
| 468 | * @return Return the value of the index |
| 469 | */ |
| 470 | static uint SlReadSimpleGamma() |
| 471 | { |
| 472 | uint i = SlReadByte(); |
| 473 | if (HasBit(i, 7)) { |
| 474 | i &= ~0x80; |
| 475 | if (HasBit(i, 6)) { |
| 476 | i &= ~0x40; |
| 477 | if (HasBit(i, 5)) { |
| 478 | i &= ~0x20; |
| 479 | if (HasBit(i, 4)) { |
| 480 | i &= ~0x10; |
| 481 | if (HasBit(i, 3)) { |
| 482 | SlErrorCorrupt("Unsupported gamma"); |
| 483 | } |
| 484 | i = SlReadByte(); // 32 bits only. |
| 485 | } |
| 486 | i = (i << 8) | SlReadByte(); |
| 487 | } |
| 488 | i = (i << 8) | SlReadByte(); |
| 489 | } |
| 490 | i = (i << 8) | SlReadByte(); |
| 491 | } |
| 492 | return i; |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * Write the header descriptor of an object or an array. |
no test coverage detected