Commit ebd25a5b authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avutil/common: Fix undefined shift

av_mod_uintp2_c uses a bitwise AND with (1 << p) - 1 to clear the high
bits of an unsigned int. But this is undefined if p == 31, because 1 is
an int and 2^31 is not representable in an int. So make 1 unsigned.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e12a2a2d
...@@ -240,7 +240,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) ...@@ -240,7 +240,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
*/ */
static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p)
{ {
return a & ((1 << p) - 1); return a & ((1U << p) - 1);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment