combined JPEG 'receive' and JPEG 'extend', since baseline always extends everything it receives.
| 2298 | // combined JPEG 'receive' and JPEG 'extend', since baseline |
| 2299 | // always extends everything it receives. |
| 2300 | stbi_inline static int stbi__extend_receive(stbi__jpeg* j, int n) { |
| 2301 | unsigned int k; |
| 2302 | int sgn; |
| 2303 | if (j->code_bits < n) |
| 2304 | stbi__grow_buffer_unsafe(j); |
| 2305 | |
| 2306 | sgn = j->code_buffer >> 31; // sign bit always in MSB; 0 if MSB clear (positive), 1 |
| 2307 | // if MSB set (negative) |
| 2308 | k = stbi_lrot(j->code_buffer, n); |
| 2309 | j->code_buffer = k & ~stbi__bmask[n]; |
| 2310 | k &= stbi__bmask[n]; |
| 2311 | j->code_bits -= n; |
| 2312 | return k + (stbi__jbias[n] & (sgn - 1)); |
| 2313 | } |
| 2314 | |
| 2315 | // get some unsigned bits |
| 2316 | stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg* j, int n) { |
no test coverage detected