Ping Here is a demo of the issue: https://godbolt.org/z/hYnYvbcjE
On 05/10/2024 23:38, Frank Plowman wrote: > The first branch of this ternary expression was intended to avoid > having two shift operations in the case the RHS is not known at > compile time. It only works if the LHS has a signed type however, > otherwise the result is invalid. > > We could alternatively have different versions of AV_CEIL_RSHIFT for > different sizes of operand, then cast the LHS to the relevant signed > type. > > Signed-off-by: Frank Plowman <p...@frankplowman.com> > --- > libavutil/common.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/libavutil/common.h b/libavutil/common.h > index 3b830daf30..ec38752b64 100644 > --- a/libavutil/common.h > +++ b/libavutil/common.h > @@ -57,8 +57,7 @@ > /* assume b>0 */ > #define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) > /* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */ > -#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ > - : ((a) + (1<<(b)) - > 1) >> (b)) > +#define AV_CEIL_RSHIFT(a,b) (((a) + (1<<(b)) - 1) >> (b)) > /* Backwards compat. */ > #define FF_CEIL_RSHIFT AV_CEIL_RSHIFT > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".