| 399 | } |
| 400 | |
| 401 | static int |
| 402 | get_code(struct Bitstream *gif, struct DataBlock *block) |
| 403 | { |
| 404 | int code; |
| 405 | |
| 406 | while (gif->num_bits < gif->bit_width) { |
| 407 | unsigned char b; |
| 408 | if (block->index >= block->size) return EOF; |
| 409 | b = block->data[block->index++]; |
| 410 | gif->bits |= (unsigned long)b << gif->num_bits; |
| 411 | gif->num_bits += 8; |
| 412 | } |
| 413 | |
| 414 | code = (int) (gif->bits & ((1UL << gif->bit_width) - 1)); |
| 415 | gif->bits >>= gif->bit_width; |
| 416 | gif->num_bits -= gif->bit_width; |
| 417 | return code; |
| 418 | } |
| 419 | |
| 420 | static unsigned |
| 421 | interlace_incr(unsigned y, unsigned height) |