From 6aa2163b6975872cab3f326218cfadf01ee2a78c Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Thu, 19 Nov 2015 15:07:55 -0800 Subject: [PATCH] bitreader/writer: Change shift to signed Silences several legal but suspicious unsigned overflows found with clang -fsanitize=integer. Change-Id: I69399751492a183167932b0a10751c433c32ca7b --- vpx_dsp/bitreader.h | 2 +- vpx_dsp/bitwriter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vpx_dsp/bitreader.h b/vpx_dsp/bitreader.h index e817c8b0c..9a441b410 100644 --- a/vpx_dsp/bitreader.h +++ b/vpx_dsp/bitreader.h @@ -98,7 +98,7 @@ static INLINE int vpx_read(vpx_reader *r, int prob) { } { - register unsigned int shift = vpx_norm[range]; + register int shift = vpx_norm[range]; range <<= shift; value <<= shift; count -= shift; diff --git a/vpx_dsp/bitwriter.h b/vpx_dsp/bitwriter.h index f6ca9b916..d904997af 100644 --- a/vpx_dsp/bitwriter.h +++ b/vpx_dsp/bitwriter.h @@ -35,7 +35,7 @@ static INLINE void vpx_write(vpx_writer *br, int bit, int probability) { int count = br->count; unsigned int range = br->range; unsigned int lowvalue = br->lowvalue; - register unsigned int shift; + register int shift; split = 1 + (((range - 1) * probability) >> 8);