jclhuff.c: Fix innocuous UBSan left shift warning
This applies the progressive Huffman encoder fixes fromaa769febf2andd65e768b2eto the new lossless mode Huffman encoder.
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
JLONG put_buffer; /* current bit-accumulation buffer */
|
||||
size_t put_buffer; /* current bit-accumulation buffer */
|
||||
int put_bits; /* # of bits now in it */
|
||||
} savable_state;
|
||||
|
||||
@@ -246,14 +246,14 @@ emit_bits(working_state *state, unsigned int code, int size)
|
||||
/* Emit some bits; return TRUE if successful, FALSE if must suspend */
|
||||
{
|
||||
/* This routine is heavily used, so it's worth coding tightly. */
|
||||
register JLONG put_buffer = (JLONG)code;
|
||||
register size_t put_buffer = (size_t)code;
|
||||
register int put_bits = state->cur.put_bits;
|
||||
|
||||
/* if size is 0, caller used an invalid Huffman table entry */
|
||||
if (size == 0)
|
||||
ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
|
||||
|
||||
put_buffer &= (((JLONG)1) << size) - 1; /* mask off any extra bits in code */
|
||||
put_buffer &= (((size_t)1) << size) - 1; /* mask off any extra bits in code */
|
||||
|
||||
put_bits += size; /* new number of bits in buffer */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user