| 510 | */ |
| 511 | |
| 512 | static void SlWriteSimpleGamma(size_t i) |
| 513 | { |
| 514 | if (i >= (1 << 7)) { |
| 515 | if (i >= (1 << 14)) { |
| 516 | if (i >= (1 << 21)) { |
| 517 | if (i >= (1 << 28)) { |
| 518 | assert(i <= UINT32_MAX); // We can only support 32 bits for now. |
| 519 | SlWriteByte((uint8_t)(0xF0)); |
| 520 | SlWriteByte((uint8_t)(i >> 24)); |
| 521 | } else { |
| 522 | SlWriteByte((uint8_t)(0xE0 | (i >> 24))); |
| 523 | } |
| 524 | SlWriteByte((uint8_t)(i >> 16)); |
| 525 | } else { |
| 526 | SlWriteByte((uint8_t)(0xC0 | (i >> 16))); |
| 527 | } |
| 528 | SlWriteByte((uint8_t)(i >> 8)); |
| 529 | } else { |
| 530 | SlWriteByte((uint8_t)(0x80 | (i >> 8))); |
| 531 | } |
| 532 | } |
| 533 | SlWriteByte((uint8_t)i); |
| 534 | } |
| 535 | |
| 536 | /** Return how many bytes used to encode a gamma value */ |
| 537 | static inline uint SlGetGammaLength(size_t i) |
no test coverage detected